Hi, Gilles assessment of the problem is rigth, the message you get is because the results of your calculation is real number and your defined variable is an integer. I think the best solution is:
Let age=Integer(date("WDATE","mdy") - date("DOB","mdy"))/30.44) The INTEGER function converts and real number into an integer. I have tried with some records and it works.
Regarding Pedro Emmanuel´s solution, I wouldn't do that except if you need the calculation during the data entry (for example to take decisions based on the age of the patient). Otherwise i wouldn't include the field in the QES in order to save room in the harddisk (I know it is not a big issue nowadays, but..) and to save room in the screen and also make it more clear.
Hope it helps.
Saludos, Pedro Arias
2007/2/20, epidata-list-rtequest@lists.umanitoba.ca < epidata-list-request@lists.umanitoba.ca>:
Send EpiData-list mailing list submissions to epidata-list@lists.umanitoba.ca
To subscribe or unsubscribe via the World Wide Web, visit http://lists.umanitoba.ca/mailman/listinfo/epidata-list or, via email, send a message with subject or body 'help' to epidata-list-request@lists.umanitoba.ca
You can reach the person managing the list at epidata-list-owner@lists.umanitoba.ca
When replying, please edit your Subject line so it is more specific than "Re: Contents of EpiData-list digest..."
EpiData-list mailing list ___________________________________
Today's Topics:
- Date range selection for age calculation (epidata-list@lists.umanitoba.ca)
Message: 1 Date: 20 Feb 2007 07:15:30 -0000 From: epidata-list@lists.umanitoba.ca Subject: [EpiData-list] Date range selection for age calculation To: epidata-list-request@lists.umanitoba.ca Cc: epidata-list@lists.umanitoba.ca Message-ID: 20070220071530.19938.qmail@webmail35.rediffmail.com Content-Type: text/plain; charset=iso-8859-1
Dear Epidata team friends, I have two American date format variables. DOB is date of birth of baby and WDATE is date of weighing the baby for the growth monitoring.
I used to write the following statement to calculate the age in months in EPI6
Define age ### Let age=(WDATE DOB)/30.44
That does not work in EPI ANALYSIS
I tried the statement; Let age= (date("WDATE","mdy") - date("DOB","mdy"))/30.44 The error message was; Data type mismatch
Please help.
Shavinder Singh
EpiData-list@lists.umanitoba.ca http://lists.umanitoba.ca/mailman/listinfo/epidata-list
End of EpiData-list Digest, Vol 40, Issue 15
-- Abraço forte e que a força esteja com você, Pedro Emmanuel
EpiData-list@lists.umanitoba.ca http://lists.umanitoba.ca/mailman/listinfo/epidata-list
End of EpiData-list Digest, Vol 40, Issue 16