Range checks do work on string variables, since EpiData just compares the internal values. However, EpiData will not care whether the strings have non-numeric values within this range. For example, the following will pass the RANGE test:
1993ABCDEFGH
since this is 12 digits and internally any string starting with "1993" will lie between "1992xxxxxxxx" and "2018xxxxxxxx"
EpiData will detect an error and assign a missing value to PRNx variables when this happens. The default option is to NOT notify you of errors in check files at data entry, so you should also check that CHECKSUM <> . If only the last digit (the checksum value) is bad, CHECKSUM <> PRN12 will tell you there is an error
In my experience, the internal precision of EpiData will let you use 12-digit integers. The RANGE checks will then work fine and entry of non numbers is impossible.
So another way to guarantee entry in this range is
define preQ2A ____________ global
preQ2 Range 1991...... etc preQ2A = string(preQ2)
and work everything on preQ2A, since it is easy to pick apart strings using the COPY function.
Where you can get into trouble with long integers is when you start to do arithmetic with them.
Jamie
Gustaf wrote:
I've now redefined preQ2 to be a string variable, but the RANGE check still works. How is this possible?
preQ2 RANGE 199201010001 201801010001 END