Date Range selection in Epi Analysis
Dear Jens,
I am trying to use Epi Analysis for the Tuberculosis data analysis. I wrote following PGM. The date formats are American (mm/dd/yyyy). The ATTDATE variable is the date of starting of Anti-tuberculosis treatment. I want to select a date range of last 3 months to see the patients put on treatment in the last quarter. This selection should provide "y" value to the PG variable defined.
The error messages received on the EpiAnalysis screen after running the command given, are given below;
*TBQ.PGM (Updated on 15th August 2006) *Program gives the QUARTERLY status report of Tuberculosis of area. READ "d:\epi6\FGTRY\TB2000.REC" SET STATISTICS=OFF
*Types the DATE RANGE of ATTDATE 3 months prior to beginning of present Quarter.
*defines the time interval of 3 months prior to present Quarter. DEFINE PQ <Y>
IF ATTDATE > date("01/01/2006","mdy") AND < date("03/30/2006",mdy") THEN LET PQ="Y" ELSE LET PQ="N"
Error Massages in Epi Analysis; Syntax Error Script resulted in errors Operation aborted
IF (ATTDATE > date("01/01/2006","mdy")) AND (ATTDATE < date("03/03/2006","mdy")) THEN LET PQ="Y" ELSE LET PQ="N"
Error Massages in Epi Analysis; Data type mismatch
IF ATTDATE date("01/01/2006","mdy") AND ATTDATE < date("03/30/2006","mdy") THEN LET PQ="Y" ELSE LET PQ="N"
Error Massages in Epi Analysis; Then is missing Script resulted in errors Operation aborted
SET STATISTICS=OFF *End of PGM.
I tried these command combinations one by one but bot no luck. The date ranges selection has been a tough challenge. The F1 help section also has no clue.
Kindly help.
Dr. Shavinder Singh Department of Community Medicine
Hi Shavinder,
The problem is not with your dates, but with PQ. Use the following syntax:
IF ATTDATE .... THEN PQ=TRUE ELSE PQ=FALSE
or
PQ = (attdate>dmy(17,4,2005)) and (attdate<dmy(19,4,2005))
The latter gets around having to put in the TRUE/FALSE values altogether since the result of everything to the right of the = is a boolean.
FREQ PQ will show values of Y and N, but will expect TRUE and FALSE in LET statements. In general Boolean variables are not supported the way they were in EpiInfo, but this is probably a good thing. Using numeric (0,1) or text ("Y", "N") is often better.
In the third IF statement you are missing an >
You can also use the function dmy(1,1,2006) in place of date("01/01/2006","mdy")
Jamie Hockin Public Health Agency of Canada
Shavinder wrote:
The error messages received on the EpiAnalysis screen after running the command given, are given below;
*TBQ.PGM (Updated on 15th August 2006) *Program gives the QUARTERLY status report of Tuberculosis of area. READ "d:\epi6\FGTRY\TB2000.REC" SET STATISTICS=OFF
*Types the DATE RANGE of ATTDATE 3 months prior to beginning of present Quarter.
*defines the time interval of 3 months prior to present Quarter. DEFINE PQ <Y>
IF ATTDATE > date("01/01/2006","mdy") AND < date("03/30/2006",mdy") THEN LET PQ="Y" ELSE LET PQ="N"
Error Massages in Epi Analysis; Syntax Error Script resulted in errors Operation aborted
IF (ATTDATE > date("01/01/2006","mdy")) AND (ATTDATE < date("03/03/2006","mdy")) THEN LET PQ="Y" ELSE LET PQ="N"
Error Massages in Epi Analysis; Data type mismatch
IF ATTDATE date("01/01/2006","mdy") AND ATTDATE < date("03/30/2006","mdy") THEN LET PQ="Y" ELSE LET PQ="N"
Error Massages in Epi Analysis; Then is missing Script resulted in errors Operation aborted
SET STATISTICS=OFF *End of PGM.
I tried these command combinations one by one but bot no luck. The date ranges selection has been a tough challenge. The F1 help section also has no clue.
Kindly help.
Dr. Shavinder Singh Department of Community Medicine
EpiData-list mailing list EpiData-list@lists.umanitoba.ca http://lists.umanitoba.ca/mailman/listinfo/epidata-list
participants (1)
-
epidata-list@lists.umanitoba.ca