[EpiData-list] DEFINE var not seen in file structure. Answer: Define in entry and in analysis have different consequences

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Sun Feb 24 04:04:40 CST 2008


There are two types of variables:
1. Variables which can be saved in files.
    In Entry these are defined in the qes file, e.g.
           var1 Label for this variable ####
    After creating the data file (rec file) and entering data, the data 
are stored in a rec file

    In Analysis variables can be created in two ways:
    a.
     Define var1  ######
     var1 = integer((today-dob)/365.25)
     label var1 "Age at date of calculation"
    b
     gen i var1 = integer((today-dob)/365.25)
     label var1 "Age at date of calculation"
   c
     In both instances (a+b) the values are only kept further on if you 
issue a saving command:
     savedata

2. Temporary variables - which are only kept in memory
   In entry these are defined as SK did:
> BEFORE FILE
>  DEFINE var1  ##### 
>  DEFINE var2  ##### 
> END
  In analysis these are defined :  (notice "global")
     define var1 #####  global

Temporary variables cannot be saved to a rec file unless the content is 
transferred to a variable saved in a data file. Sometimes we call 
variables in data files for "fields" in contrast to what is only in 
memory. SK could argue that define  should do the same in analysis and 
entry to avoid the confusion.

In other words now SK can get the results of the calculation saved for 
analysis by:

Add to the qes file
 aged Age in days #####
 agem Age in months ####

chk file.
  remove the "define" in before file but keep the calculation "let" in 
the "after entry" block
  and add this

aged
 noenter
end

agem
 noenter
end

regards
Jens Lauritsen
EpiData Association


More information about the EpiData-list mailing list