CHK file with calculations does not work as it did in EpiInfo
Hi,
I wonder if someone can spot the syntax problem in this CHK file for the Beck Depression inventory. I've struggled for hours to get it to work the way it did under Epi Info. Basically, there are three conditions in an IF statement. I've tried with the two simple conditions alone and the script works (condition at the beginning & at the end). Combining conditions always gives the 'atrisk' calculated variable the answer "N". Is there a limitation or syntax difference in Epidata??
Here's the syntax. thanks for the help.
BEFORE FILE DEFINE TOTALPG1 ## GLOBAL DEFINE TOTALPG2 ## GLOBAL DEFINE varID #### END
AFTER RECORD TOTALPG1=N1SAD+N2DISCOURA+N3FAILURE+N4SATISFAC+N5GUILT+N6PUNISHED+N7DISAPPOI+N8SELFCRIT+N9SUICIDE+N10CRY+N11IRRITAT TOTALPG2=N12INTPPL+N13DECISIO+N14LOOKWOR+N15CANWORK+N16SLEEP+N17TIRED+N18APPETIT+N19WEIGHT+N20WORRYHL+N21INTSEX TOTAL=TOTALPG1 + TOTALPG2 IF N9SUICIDE = 3 or (N9SUICIDE = 2 AND TOTAL >= 16) or TOTAL > 42 THEN ATRISK="Y" ELSE ATRISK="N" ENDIF END
idnum MUSTENTER REPEAT AFTER ENTRY VarID=IDNUM END END
total NOENTER END
atrisk NOENTER END
n1sad RANGE 0 3 END
etc. for the other variables
John LeBlanc __________________________________________________________
John C. LeBlanc, MD, MSc, FRCPC Associate Professor Pediatrics, Psychiatry, Community Health and Epidemiology Dalhousie University
IWK Health Centre Work phone: (902) 470-8930 5850 University Avenue Work fax: (902) 470-6913 Halifax, Nova Scotia Email: John.LeBlanc@Dal.Ca B3K 6R8 CANADA Pager: (902) 470-8888 __________________________________________________________
Unless, something go lost, there is surely something missing here:
IF N9SUICIDE = or (N9SUICIDE = 2 AND TOTAL >= 16) or TOTAL > 42
Hans
epidata-list@lists.umanitoba.ca wrote:
Hi,
I wonder if someone can spot the syntax problem in this CHK file for the Beck Depression inventory. I've struggled for hours to get it to work the way it did under Epi Info. Basically, there are three conditions in an IF statement. I've tried with the two simple conditions alone and the script works (condition at the beginning & at the end). Combining conditions always gives the 'atrisk' calculated variable the answer "N". Is there a limitation or syntax difference in Epidata??
AFTER RECORD TOTALPG1=SAD+N2DISCOURA+N3FAILURE+N4SATISFAC+N5GUILT+N6PUNISHED+N7DISAPPOI+N8SELFCRIT+N9SUICIDE+N10CRY+N11IRRITAT TOTALPG2=2INTPPL+N13DECISIO+N14LOOKWOR+N15CANWORK+N16SLEEP+N17TIRED+N18APPETIT+N19WEIGHT+N20WORRYHL+N21INTSEX TOTAL=TALPG1 + TOTALPG2 IF N9SUICIDE = or (N9SUICIDE = 2 AND TOTAL >= 16) or TOTAL > 42 THEN ATRISK=" ELSE ATRISK=" ENDIF END
Thanks Hans, I don't know what happened. This is what was pasted except that I exchanged the double quotes for single quotes in case that is why text got truncated.
IF N9SUICIDE = 3 or (N9SUICIDE = 2 AND TOTAL >= 16) or TOTAL > 42 THEN ATRISK='Y' ELSE ATRISK='N' ENDIF END
John LeBlanc ----------------------------------------- Message: 2 Date: Tue, 04 Mar 2008 20:10:27 +0100 From: epidata-list@lists.umanitoba.ca Subject: Re: [EpiData-list] CHK file with calculations does not work as it did in EpiInfo To: epidata-list@lists.umanitoba.ca Message-ID: 47CD9EA3.5000402@tbrieder.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Unless, something go lost, there is surely something missing here:
IF N9SUICIDE = or (N9SUICIDE = 2 AND TOTAL >= 16) or TOTAL > 42
Hans
John LeBlanc
On Tue, 4 Mar 2008 12:50:55 -0400, John LeBlanc wrote: Hi,
I wonder if someone can spot the syntax problem in this CHK file for the Beck Depression inventory. I've struggled for hours to get it to work the way it did under Epi Info. Basically, there are three conditions in an IF statement. I've tried with the two simple conditions alone and the script works (condition at the beginning & at the end). Combining conditions always gives the 'atrisk' calculated variable the answer "N". Is there a limitation or syntax difference in Epidata??
Here's the syntax. thanks for the help.
BEFORE FILE DEFINE TOTALPG1 ## GLOBAL DEFINE TOTALPG2 ## GLOBAL DEFINE varID #### END
AFTER RECORD TOTALPG1=N1SAD+N2DISCOURA+N3FAILURE+N4SATISFAC+N5GUILT+N6PUNISHED+N7DISAPPOI+N8SELFCRIT+N9SUICIDE+N10CRY+N11IRRITAT TOTALPG2=N12INTPPL+N13DECISIO+N14LOOKWOR+N15CANWORK+N16SLEEP+N17TIRED+N18APPETIT+N19WEIGHT+N20WORRYHL+N21INTSEX TOTAL=TOTALPG1 + TOTALPG2 IF N9SUICIDE = 3 or (N9SUICIDE = 2 AND TOTAL >= 16) or TOTAL > 42 THEN ATRISK="Y" ELSE ATRISK="N" ENDIF END
idnum MUSTENTER REPEAT AFTER ENTRY VarID=IDNUM END END
total NOENTER END
atrisk NOENTER END
n1sad RANGE 0 3 END
etc. for the other variables
John LeBlanc __________________________________________________________
John C. LeBlanc, MD, MSc, FRCPC Associate Professor Pediatrics, Psychiatry, Community Health and Epidemiology Dalhousie University
IWK Health Centre Work phone: (902) 470-8930 5850 University Avenue Work fax: (902) 470-6913 Halifax, Nova Scotia Email: John.LeBlanc@Dal.Ca B3K 6R8 CANADA Pager: (902) 470-8888 __________________________________________________________
participants (1)
-
epidata-list@lists.umanitoba.ca