[EpiData-list] forcing 3-digit id numbers

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Sun Feb 17 19:11:10 CST 2008


The reason Hans' solution is the best way to go is that range checking 
on strings is not a good way to check for numbers. For example, with

  RANGE 000 150

entries like 10x will pass, since the string "10x" lies between "109" 
and "110", as do many, many other possible wrong entries. So RANGE will 
be quite happy.

If you want to force entry of 3 digits as strings, then it is best to 
enter them as single digits and check the range of each one, AND THEN, 
check the range of the resulting number. Basically, you are having to do 
what EpiData does for you whenever you enter an integer.

The .chk code isn't that difficult - let me know if you want to do it 
that way and I will post it.


Vicky wrote:
>> The ID must be between 001 and 150 and it is a 3-character string 
>> field to ensure 054 is entered, for instance, rather than 54.

More information about the EpiData-list mailing list