Hi Yves,
That's very helpful. I now have the check file doing what I want. Thanks so much for your help.
Cheers, Suzanna
At 08:17 PM 15/06/2007 +0000, you wrote:
Hi Suzanna,
I see two different cases:
- You want to calculate age at assessment after data entry has been
completed. Then you only need to relate both .rec files using Epidata analysis. Once both files are related you can use variables from any of them to calculate what you want. However, you can only save the results of the calculations by recording a new file.
- You want to calculate age at assessment when entering the data.
According to your code I guess that this is what you want to do. The case is pretty the same than above, but:
- you need to define a "global variable" to store the value of the date of
birth (from the first file); this "global variable" is kept in memory when the data entry process comes to the second (related) file.
- once, in the second file, you have entered the value of "date of
assessment", you can do the calculation "date of assessment - global variable" (which contains the value of date of bith) and you can store the result in the variable "age at assessment" of the second file..
IN THE DEMO.CHK:
BEFORE RECORD DEFINE GDOB <dd/mm/yyyy> GLOBAL END
DOB AFTER ENTRY LET GDOB = DOB END END
IN THE (RELATED) ASSESS.CHK:
DATEASS END
AGEASS BEFORE ENTRY LET AGEASS = (dateass - GDOB)/365.25 GOTO next variable END END
I hope this helps
Good luck
Yves MP
Yves MARTIN-PREVEL, Epidemiologist, MD, MSc, PhD Nutrition Unit (WHO Collaborating Center for Nutrition) Institut de Recherche pour le Développement (IRD) 01 BP 182 - OUAGADOUGOU 01 - BURKINA FASO Tel: +226 50 30 67 37; Fax: +226 50 31 03 85 http://www.ird.bf/
epidata-list@lists.umanitoba.ca a écrit :
Dear fellow EpiData users, I have 2 data files, a demographics file called demo.rec and an assessment file called assess.rec. Demo.rec contains date of birth while assess.rec contains date of assessment. I'd like to calculate the age at assessment and display the age in assess.rec during data entry. How can I do a calculation using fields in 2 different files? An abbreviated version of my files with just the relevant fields are: demo.qes idno ### dob <dd/mm/yyyy> gender # demo.chk idno KEY UNIQUE 1 END gender LEGAL 1 2 END AFTER ENTRY RELATE idno assess END END assess.qes idno ### dateass <dd/mm/yyyy> ageass ##.# assess.chk idno KEY 1 END dateass AFTER ENTRY LET ageass=(dateass-???)/365.25 END END ageass NOENTER END Any help would be greatly appreciated. Thanks, Suzanna Suzanna Vidmar Senior Research Officer Clinical Epidemiology and Biostatistics Unit Royal Children's Hospital Flemington Rd Parkville Victoria 3052 telephone: +61 3 9345 6372 facsimile: +61 3 9345 6000 _______________________________________________ EpiData-list mailing list EpiData-list@lists.umanitoba.ca http://lists.umanitoba.ca/mailman/listinfo/epidata-list
EpiData-list mailing list EpiData-list@lists.umanitoba.ca http://lists.umanitoba.ca/mailman/listinfo/epidata-list
Suzanna Vidmar Senior Research Officer
Clinical Epidemiology and Biostatistics Unit Royal Children's Hospital Flemington Rd Parkville Victoria 3052
telephone: +61 3 9345 6372 facsimile: +61 3 9345 6000