Archive | Appendices

SPSS or SAS or PSPP or … and CANDAT

SPSS, SAS  (or other good statistical packages) is used to process Candat calculations into results for your scientific report.

At its most detailed Candat will produce data files consisting of:

  • Subject code
  • Date
  • Day of Week code (0-6, where 0 is Sunday)
  • Food Group code
  • Meal code
  • Food code
  • Food description
  • Nutrient variables (Weight of foods and all nutrients you selected at reporting)

The printed (text or PDF) file (hopefully you did not print to paper) can have all of the above information as well as basic statistics (for a quick perusal, not meant to be used instead of a statistical package).

Candat also produces computer readable files that can be directly read into statistical packages or spreadsheet software (such as Excel or Open or Libre Office Calc or ….) . . Your study will probably want to make use of daily average intake data, as representative as possible of your subject’s usual intake.

Where you have days of the week and weekend days you will probably want to make use week-weighted average daily intakes, where weekend days carry less weight than week days. These week-weighted averages are calculated in Candat but should be re-calculated in the statistical package so that you can make use of the proper variance calculations for weighted data.

Systematically then here are the procedures to follow for managing your data:

  • Generate the data in Candat you need in a compact way. If you are not interested in data by meals or by food group or at the food detail level, leave those out of the Candat calculation.
  • Read the Candat generated file into a statistical package
  • Identify missing data as -1 (the Candat value at the food level. In Candat summaries (means) missing values are considered a zero. This makes sense because food databases do not spend much time analyzing nutrients that are not likely to exist in the food but they do not report them as having a value of zero (usually).
  • Convert the Day of Week code to a weight to be used in week weighted calculations. In Candat we use 5 for codes 1 to 5 and 2 for codes 0 and 6.
  • Weight the cases using the converted Day of Week variable
  • Aggregate the cases. In most cases you will want to aggregate the data using Subject code and Date code as independent variables, an average weight code for the weighting variable (average will maintain the weight code for the day)  and sum (which adds up all the contributions for that day) for the nutrient variables. At this point your data is ready for statistical processing.
  • Apply exploratory statistics to all your variables and make sure the data seems reasonable
  • Merge the data variables that identify your subject variables. This may be from a file produced externally from Candat or from the Candat Description file.  In either case you must make sure to merge on the Subject codes.
  • Compare your subjects to your control groups (subject variables) using statistical procedures and save the results.

Report these results, write the other sections of the paper and you are done.


Week-weighted Averages in CANDAT

When expressing and comparing results of multi-day (3 day commonly) food recalls one tends to use the average daily intake as a measure of a subject’s intake. Of course, 7 day recalls will give more accurate estimates of this daily intake and the accuracy will increase if all the days of a week are used. The assumption here is that subjects will eat differently on different days with the greatest variability been between week days and weekend days.

Rather than simply computing an average daily intake one may get more accurate results by weighting the days of the week and the weekend days differently.

A weight of 5 for each week day and a weight of 2 for weekend days should allow us to calculate week-weighted averages for any number of recalls. Of course, for recalls without weekends this would just be a day of the week average and vice-versa.

The week-weighted average could be calculated as follows:

xw = (∑ wi × xi) ÷ ∑ w

where xw is the weighted average with  xi as the daily intakes, and i is 1 – 5 (codes for days of the week) or 0,6 codes for weekend days corresponding to Sunday and Saturday respectively. w1-5 would then be 5 and w0,6 would be 2.

with a variance of

Var(xw) = Var(x) × ((∑ wi2) ÷ (wi)2)

where Var(x) would be the variance over all the days of the food intakes for the subject.

Essential CANDAT information

This section explains the CANDAT software environment. You need to have a feeling for the following three areas:

  1. Navigating CANDAT, how to get to and start the tasks;
  2. How to respond to typical prompts within the task:
    1. for selecting database files;
    2. for selecting individual records within those files;
    3. for printing;
  3. The computer structure of folders and sub-folders that support CANDAT

CANDAT Environment (GRASP)

GRASP (General Reporting and Application Support Package) is an environment which contains standard mechanisms for communicating between the user and the computer. This allows for consistency within applications and is the background within which CANDAT is defined.

GRASP assumes a well defined user area on the disk (usually created at installation) and a structure of modules and tasks. Modules identify broad areas of functionality. There are modules for food files, nutrient tables, category (food group) definitions and RNI tables, subject files, recipe files, food frequency (history) questionnaires, and file maintenance utilities. Tasks define the functianlity of CANDAT and together, define the tasks required for food intake research.

The basic functional unit of an application is the task. There is a two level menu structure that directs the user to the task required. The first level lists general areas of the application., the second lists the tasks. We will use CANDAT as an example application to show menus. The first and A second level menu of CANDAT are shown here:

menu main 4

menu recipes

To choose a particular item in a menu just cursor down to that item and press Enter or type the first character ot the item. In this case, the “4” was pressed which immediately brought up the Recipe menu. Pressing Enter on the first item in the Recipe menu, in this case 400  Recipe file maintenance, essentially Task400 in the CANDAT system, would activate that task and bring up the following menu, a menu common to all the tasks.

Task startup menu

Once a task has been chosen and it has been read in by the computer, the following menu is displayed:

Activity options

At the end of a task, the same menu appears again. You can choose at this point to restart the task by choosing the first option again.

There are two ways to exit from CANDAT. One is temporary and leaves CANDAT in memory, ready to be reactivated. This is the EXIT to DOS choice. To return to CANDAT after choosing this alternative, simply type EXIT from within DOS and you will be returned to CANDAT. Do not try to start a new session of CANDAT if you exited this way. You will quickly use up all of your memory and may not be able to start another session if you do so. If you choose QUIT and return to the operating system, CANDAT is released from memory and terminates normally.

Data entry prompts

CANDAT prompts you for information in the form of a list of choices or tables. Lists are referred to as menus, not to be confused with menus used in restaurants. CANDAT will also prompt you for single field entries as in food codes, date of recalls, etc. An entry of a blank code or a 0 serves to cancel the prompt.

  1. There are three kinds of menus presented in CANDAT.
    1. The usual menu is a list of items. You are expected to make a single choice. That is done by moving the selection bar (cursor) to the choice and pressing the enter key. Another way of accomplishing the same thing is to enter the first letter or number of the choice. Pressing the Esc (escape) key chooses the last item in the list or exits menu selection without making a choice.
    2. Another menu type gives you a series of Yes/No items which you toggle by pressing the Y or N keys. You can also make all the choices Y or all N by pressing the Alt key with your selection of Y or N.
    3. The third menu selection consists of a single field at the bottom of the screen. This field usually expects a record key (in the case of a food database, this would be the food code, in the case of a recipe database, this would be the recipe code). The F6 key, found in the row of F keys at the top of your keyboard, serves as an information key. Pressing it will give you various options, from a simple list of codes that you can enter in the field to a search bar in which you can put keywords that are found in the description of the item. In either case you can choice the desired item from the list of items that appears and the proper code will be entered in the field automatically. Keyword searches are very simple. If you put in two keywords, seperated by a space, both must be present in the description in order for the search to be successful. If you wish one item or the other or both, seperate the keywords with a comma.
  2. There are two kinds of table entry in CANDAT.
    1. The usual table entry allows you to enter information within each cell of a table. Some cells will only allow numbers, others, both numbers and characters. Whichever is allowed will be obvious from the context. If you try to enter a character and it does not appear in the cell, the cell is probably expecting a number. Blank cells are considered filled with characters and you will not be allowed to move out of a number cell until you insert a number. A 0 is usually sufficient. If this entry resulted in an extra line being added to the table, it can usually be removed using Alt F4 (see below). Some of these tables grow automatically as you try to enter another row. Pressing the Enter key in the last cell of the last row of a table activates this feature. You cannot simply move to a row that does not exist by using cursor controls. Other rows can be inserted and deleted in these “growing” tables by using Alt F3 to add lines and Alt F4 to delete lines. To exit after having entered your information, press the Esc key. You can move from cell to cell by pressing Tab (or back Tab) and by using the cursor control keys. You can also use Ctrl Home and Ctrl End to go to the first and last cells respectively. In some contexts the function keys F1 and F6 will provide you with additional information which is just shown (in the case of F1) or serves as input based on your choice in the case of F6.
    2. The other type of table entry allows editing of a full line at a time. This is a free form type of entry. and you need to be careful of the layout of the information as it is not controlled by the software. To exit after having entered this information you must press Ctrl E or Ctrl Q. Ctrl E will save your entries, Ctrl Q will quit without saving your entries. CANDAT has very few of these types of table entry.

Printing reports

Reports produced by CANDAT can be sent to a printer, a file or both and, in the case of subject calculated data (task 340), to documented files. CANDAT is configured to print to LPT1 (or text files if you wish). The printer definition within CANDAT which ensures printing to LPT1 is called PRNTLPT1. It can be set in Activate System Utilities menu, under Activity Options menu. Activity Options is available as a menu item in each Module or Task selection menu as well as in the Task startup menu. This is explained in more detail under those menus.

In order to use your Windows printers you need a software such as DOS2USP which captures the LPT1 port.  It can be obtained here as a trial version and as a permanent version for a very low cost. The advantage of printing to Windows printers is that you can create PDF files from CANDAT output and be better able to manage the large volumes of data produced. A configuration of that program which works well with CANDAT is shown here:


Once installed and these settings defined (do not forget to click on Save Settings) you can forget about the DOS2USP program. It will always be on your computer, will start when you start Windows and will just be used with CANDAT or some other DOS program you may have on your computer. Set it up once and forget about it.

Paper definitions

CANDAT uses paper size to layout reports for printing. Please note that this paper size is independent from the one above. Paper size is a menu item under Activity Options (see above). Paper size is always defined in portrait mode, even if you wish to print in landscape mode (sideways). CANDAT determines the size of the report in relation to the size of the paper available. A few reports cannot print on paper 8.5 in. wide. These reports need to be printed on wider paper or need to be printed in landscape mode. When CANDAT detects this situation, it prompts you to change your paper definition so that it can continue. You must then switch to landscape (if you have landscape capabilities on your printer) or specify wider paper.

Printer definitions

The DOS2USB program allows you to define the print device (which can be a .PDF file), the font and the font size to use for the report. This printer definition works in conjunction with CANDAT to provide the printed (or visual) representation of the reports. CANDAT defines the width of the report and the length of the pages based on its paper definition (see above). DOS2USB makes this definition fit on a page or on the screen.

Most of the reports in CANDAT are presented in a table form. A fixed font (such as Courier New) is preferable as it uses characters that are all the same width. An “M” has the same width as an “I”. A “1″ has the same width as a “0″. This allows columns of data and numbers to line up properly and be easier to read.  Font size is set here too. Please note that these sizes are in CPI (Characters per inch) and not in dots per inch as in windows. A larger CPI results in smaller characters and vice versa.  A bit of experimenting with the paper setups of CANDAT and the printer setups of DOS2USB will have you producing beautiful reports very quickly.

Output to text files

Most of the reports in CANDAT which can print on paper can also print to files. You are prompted for the file name and the file is created in your user area (see Structure – Users, below). Use eight characters only for file names, no spaces and no special characters. CANDAT will append an extension of .TXT to these files so that they are readily identifiable. All such files will be created in the user folder identified at CANDAT installation.

You have a choice of printing with printer control codes or not. Printing without control codes makes the assumption you will be importing the information into a word processing or other type of program using “cut-and-paste”. Titles and headers are then also not printed. If you wish to print to file with titles and headers and no control codes, specify printer type “none” and print to files specifying control codes. The “none” printer type does not output printer control codes.

Output to save files

Reports that are the result of nutrient calculations can be output to files that you can either open with a word processor or import into a spreadsheet environment (like Excel) or adatabase environment (like SAS, SPSS or other statistical package) . You are prompted for a file name and different files are created using those names in your user SAVE area. Use eight characters only for file names, no spaces and no special characters. CANDAT will append various extensions to these files so that they are readily identifiable. All such files will be created in the user folder, sub-folder SAVE,  identified at CANDAT installation.

Structure – Users

CANDAT is licensed on a per computer basis. CANDAT may be installed on only those computers and networks for which it is licensed. It is possible for multiple users to use CANDAT simultaneously when installed in a network. You are only allowed the number of simultaneous users negotiated in your purchase agreement.

Any one license (on one computer) can and is allowed to support any number of users. Users are created within CANDAT using a NEWUSER2 creation process. This process creates a folder for the user, specific to the disk (memory stick or other USB device) drive specified at creation. Note that CANDAT records the drive on which the user is created. Users must function on the drive specified at creation in order for CANDAT to be able to function properly. This is particularly important in a laboratory structure where users may connect their memory sticks to a USB port and create their own environment. CANDAT creates an icon with the particulars of the user drive. A user can manually change the drive in the properties of this icon to correspond to the drive of their memory stick, if used on another computer. For instance, a user could create an environment on their memory stick under the  “F” drive in the laboratory environment and then need to use it on the “G” drive of another computer.

User folders store food files, category files, subject files, questionnaire files, save files, and recipe files.  For a user to use another user’s files, those files must be copied to the relevant user folder. There is no user identification on the files themselves. This structure also allows the same (project) name to be used for each of the food, category, subject, etc. files. Please note that the user structure and files is never deleted by CANDAT or by re-installation of CANDAT. It is always prudent, however, to fully backup the user structure and its files.

Structure – Modules and Tasks

CANDAT has a unique structure for Users and for Food files. The actual work performed by CANDAT is organized in a structure of Modules and Tasks.

Modules identify broad areas of functionality. There are modules for food files, nutrient tables, category (food group) definitions and RNI tables, subject files, recipe files, food frequency (history) questionnaires, and file maintenance utilities.

Tasks are found within modules and provide the detailed interaction with the User. It is within tasks that subject data is entered, recipes and food files are created, nutrient data is calculated, reports are produced, etc. The titles of the modules are self explanatory as are the titles of the tasks. Follow the prompts within the tasks and you should be able to accomplish your work with ease.

call: +1 (877) 977-2664 (toll free)