The concept of validation of dates is that only legitimate dates can be entered. While you can enter partial dates, they must correspond to real dates. For example entering 15 into your date field will yield a date of the 15th of the current month (e.g. 11/15/2008) as EpiData assumes you just entered the day. But you cannot put in invalid days (i.e must 1-# of days in the month).
You could just let people leave the field blank, but I know that many experts feel that entering something in every field is a better practice.
I suggest you pick a date such as 01/01/2020 to be your skip value and just let users leave the field blank as they enter data. Then provide a prompt to ensure that the date was meant to be skipped. This ensures that an accidentally skipped date field is validated immediately.
legdat RANGE 01/01/1900 31/12/2008 LEGAL 01/01/2020 END if legdat = . then legdat = date(1,1,2020) help "Confirm that data is not entered - will show as 01/01/2020" endif end
If you really insist on having something like 77 represent the skip, then you will have to construct your own date and validate it via a second field. The DATE function will give an error message if an invalid date is created. The user is forced to back up and fix the date fields. It's not pretty, though.
.qes:
legdat ## ## #### (3 fields with names legdat legdat1 legdat2 as day, month, year) legdatd <dd/mm/yyyy> nextfield ###
.chk:
legdat range 0 31 legal 77 88 end jumps 77 nextfield 88 nextfield end end
legdat1 range 1 12 end
legdat2 range 1900 2008 legdatd = date(legdat, legdat1, legdat2) end
Jamie Lindsay wrote:
Thank you for your response to my date question.
During entry, if the date field is not applicable to a certain record (whereas I do not need to enter a date for that specific record, rather skip it) what do I designate as my skip code. I did have -77, but when I would enter that, it would say it was an illegal entry.
How do I write the code, so that a skip is -77, and it still be a legal entry in some instances?
legdat RANGE 01/01/1900 31/12/2008 LEGAL 30/12/2009 24/11/2008 END END
(somewhere in there, I need to put it a skip code)
Thank you for your time,
Lindsay