Is there a way of extending a command in the EpiData Entry CHK file beyond a single line? In my example below I've got around the problem by using nested IF... THENs but there may be another way. For instance in Stata a command can be extended over multiple lines by ending each line with ///.
admit1mon
AFTER ENTRY
IF (admit1mon<>"JAN") AND (admit1mon<>"FEB") AND (admit1mon<>"MAR") AND (admit1mon<>"APR") AND (admit1mon<>"MAY") AND admit1mon<>"JUN") THEN
IF (admit1mon<>"JUL") AND (admit1mon<>"AUG") AND (admit1mon<>"SEP") AND (admit1mon<>"OCT") AND (admit1mon<>"NOV") AND (admit1mon<>"DEC") THEN
HELP "Month is a 3 character field, e.g. JAN, FEB, etc" TYPE=ERROR
GOTO admit1mon
CLEAR admit1mon
ENDIF
ENDIF
END
END
Cheers,
Suzanna Vidmar Senior Research Officer Clinical Epidemiology and Biostatistics Unit
Murdoch Childrens Research Institute Royal Children's Hospital Flemington Road Parkville Victoria 3052 Australia
telephone: +61 3 9345 6372 facsimile: +61 3 9345 6000 email: suzanna.vidmar@mcri.edu.au www.mcri.edu.au http://www.mcri.edu.au/
You can use long lines in check. The check editor for a field will let you create a line somewhat over 200 characters; you may be able to go longer if you use another editor. In your example, why not let EpiData do the checking by specifying LEGAL values for months? It seems odd to be entering month by name in any case, but you can specify the 12 legal values quite easily and train your data entry clerks that EpiData will beep for an illegal entry.
If you want your own error message to come up, an elegant way to check without the long if statement or nesting is as follows:
admit1mon AFTER ENTRY if pos("#"+admin1mon,"#JAN#FEB#MAR#APR#MAY#JUN#JUL#AUG#SEP#OCT#NOV#DEC) = 0 then HELP "Month is a 3 character field, e.g. JAN, FEB, etc" TYPE=ERROR CLEAR admit1mon GOTO admit1mon ENDIF END
Jamie
On 2010-07-27, at 8:37 PM, epidata-list@lists.umanitoba.ca wrote:
Is there a way of extending a command in the EpiData Entry CHK file beyond a single line? In my example below I've got around the problem by using nested IF... THENs but there may be another way. For instance in Stata a command can be extended over multiple lines by ending each line with ///.
Thanks Jamie. I haven't found a way to extend a command over multiple lines and it looks as though it isn't possible. I don't think the issue is the editor. I could type well over 200 characters into EpiData's editor. The problem was that EpiData then ignored my check when I tested entering data into the month fields. Thanks for the pos function tip. It'll probably come in handy again. Cheers,
Suzanna Vidmar Senior Research Officer Clinical Epidemiology and Biostatistics Unit
Murdoch Childrens Research Institute Royal Children's Hospital Flemington Road Parkville Victoria 3052 Australia
telephone: +61 3 9345 6372 facsimile: +61 3 9345 6000 email: suzanna.vidmar@mcri.edu.au www.mcri.edu.au
-----Original Message----- From: epidata-list-bounces@lists.umanitoba.ca [mailto:epidata-list-bounces@lists.umanitoba.ca] On Behalf Of epidata-list@lists.umanitoba.ca Sent: Thursday, 29 July 2010 3:17 AM To: epidata-list@lists.umanitoba.ca Subject: Re: [EpiData-list] Extending command over multiple lines
You can use long lines in check. The check editor for a field will let you create a line somewhat over 200 characters; you may be able to go longer if you use another editor. In your example, why not let EpiData do the checking by specifying LEGAL values for months? It seems odd to be entering month by name in any case, but you can specify the 12 legal values quite easily and train your data entry clerks that EpiData will beep for an illegal entry.
If you want your own error message to come up, an elegant way to check without the long if statement or nesting is as follows:
admit1mon AFTER ENTRY if pos("#"+admin1mon,"#JAN#FEB#MAR#APR#MAY#JUN#JUL#AUG#SEP#OCT#NOV#DEC) = 0 then HELP "Month is a 3 character field, e.g. JAN, FEB, etc" TYPE=ERROR CLEAR admit1mon GOTO admit1mon ENDIF END
Jamie
On 2010-07-27, at 8:37 PM, epidata-list@lists.umanitoba.ca wrote:
Is there a way of extending a command in the EpiData Entry CHK file beyond a single line? In my example below I've got around the problem
by
using nested IF... THENs but there may be another way. For instance in Stata a command can be extended over multiple lines by ending each
line
with ///.
_______________________________________________ EpiData-list mailing list EpiData-list@lists.umanitoba.ca http://lists.umanitoba.ca/mailman/listinfo/epidata-list
In EpiData Analysis you use a single backslash \ but this is not supported in EpiData Entry nor is there an alternative, I believe.
Hans Rieder
On 20:59, epidata-list@lists.umanitoba.ca wrote:
Is there a way of extending a command in the EpiData Entry CHK file beyond a single line? In my example below I've got around the problem by using nested IF... THENs but there may be another way. For instance in Stata a command can be extended over multiple lines by ending each line with ///.
admit1mon
AFTER ENTRY
IF (admit1mon<>"JAN") AND (admit1mon<>"FEB") AND (admit1mon<>"MAR")
AND (admit1mon<>"APR") AND (admit1mon<>"MAY") AND admit1mon<>"JUN") THEN
IF (admit1mon<>"JUL") AND (admit1mon<>"AUG") AND
(admit1mon<>"SEP") AND (admit1mon<>"OCT") AND (admit1mon<>"NOV") AND (admit1mon<>"DEC") THEN
HELP "Month is a 3 character field, e.g. JAN, FEB, etc"
TYPE=ROR
GOTO admit1mon CLEAR admit1mon ENDIF ENDIF
END
END
Cheers,
Suzanna Vidmar
The correspondance on this topic all seems correct. To avoid very long lines some logic can be helpfull and work (with some experimentation).
(The following examples should work, but please verify I have not tested in detail)
find months spelling errors:
------------------------------------------------------------------------------------------------------------------
admit1mon after entry if pos(admit1mon,"JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC") = 0 then HELP "Month is a 3 character field, e.g. JAN, FEB, etc" TYPE=ROR GOTO admit1mon CLEAR admit1mon ENDIF end end ------------------------------------------------------------------------------------------------------------------
If for some reason you prefer to use months for entry I would suggest this: admitm range 1 12 after entry tempm = 1 +(3*admitm) -3 admit1mon = copy("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC",temp,3) end end
admit1mon noenter end ------------------------------------------------------------------------------------------------------------------ Also - since numbers are faster to enter than letters I would prefer the second suggestion.
regards Jens Lauritsen Epidata Association
Thanks Jens for your suggestions. I'll keep them in my EpiData "How To" file.
Suzanna Vidmar Senior Research Officer Clinical Epidemiology and Biostatistics Unit
Murdoch Childrens Research Institute Royal Children's Hospital Flemington Road Parkville Victoria 3052 Australia
telephone: +61 3 9345 6372 facsimile: +61 3 9345 6000 email: suzanna.vidmar@mcri.edu.au www.mcri.edu.au
-----Original Message----- From: epidata-list-bounces@lists.umanitoba.ca [mailto:epidata-list-bounces@lists.umanitoba.ca] On Behalf Of epidata-list@lists.umanitoba.ca Sent: Monday, 2 August 2010 2:06 AM To: epidata-list@lists.umanitoba.ca Subject: Re: [EpiData-list] Extending command over multiple lines
The correspondance on this topic all seems correct. To avoid very long
lines some logic can be helpfull and work (with some experimentation).
(The following examples should work, but please verify I have not tested
in detail)
find months spelling errors:
------------------------------------------------------------------------ ------------------------------------------
admit1mon after entry if pos(admit1mon,"JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC") = 0 then HELP "Month is a 3 character field, e.g. JAN, FEB, etc" TYPE=ROR GOTO admit1mon CLEAR admit1mon ENDIF end end ------------------------------------------------------------------------ ------------------------------------------
If for some reason you prefer to use months for entry I would suggest this: admitm range 1 12 after entry tempm = 1 +(3*admitm) -3 admit1mon = copy("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC",temp,3) end end
admit1mon noenter end ------------------------------------------------------------------------ ------------------------------------------ Also - since numbers are faster to enter than letters I would prefer the
second suggestion.
regards Jens Lauritsen Epidata Association _______________________________________________ EpiData-list mailing list EpiData-list@lists.umanitoba.ca http://lists.umanitoba.ca/mailman/listinfo/epidata-list
participants (1)
-
epidata-list@lists.umanitoba.ca