Hi family,
Thank you so much for your guide...
I have successfully created a variable name(Item) called DOI with sub items to automatically capture the system date with logic as stated below
PROC DOI
preproc
if demode() = 1 then
DOI = sysdate("DDMMYYYY");
endif;
Now
I have successfully created a variable name(Item) called DOB with sub items for enumerators to capture the Date of Birth in same format as
(DDMMYYY) with a logic to validate the date of birth as indicated below;
PROC DOB
numeric birthDate = A1C * 10000 + A1B * 100 + A1A;
numeric isValidDate = datevalid(birthDate);
if not isValidDate then
errmsg("Birth date - %d/%d-%d is not a valid date. Please reenter", A1A, A1B, A1C);
endif;
Now I have have created a 3rd variable(Item) called Age in complete(D1) for the enumerators to enter the complete Age of the respondent refrence the the Date caputured above.
I taught of creating a logic to actually validate the ages the enumerators captured in (D1) using the Datediff function as below;
PROC D1
postproc
if datediff(DOB, DOI, "y") <> D1 then
errmsg("Age (%d) does not match date of birth (%d)", D1, DOB)
select("Correct Age", D1, "Correct date of birth", DOI);
endif;
And it is not working.
I need clarity on how to go around this without changing the paten of the date format ( from DDMMYYYY) to (YYYYMMDD)
I attached the file for your study.
Thank you.
Sham.
Date(YYYYMMDD) or Date(DDMMYYYY)
Date(YYYYMMDD) or Date(DDMMYYYY)
- Attachments
-
- DATE ISUES.zip
- (46.21 KiB) Downloaded 79 times
-
- Posts: 1795
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Date(YYYYMMDD) or Date(DDMMYYYY)
You'll have to convert the dates to use the CSPro built-in functions. See here for an example:
viewtopic.php?f=1&t=3458
viewtopic.php?f=1&t=3458
Re: Date(YYYYMMDD) or Date(DDMMYYYY)
@ George,
Thank you soo much.
AM very grateful
Thank you soo much.
AM very grateful