Hi all, I am running this code but its giving me 5 errors. I have attached both my code and my log for your reference option mprint mlogic symbolgen ;
*STEP 1 ;
/*CALCUALTING THE NUMBER OF PATIENTS WITH THE APPLICABLE ENDPOINT (ONLY FIRST EVENT TO BE COUNTED) */
/*FLAG COMORBIDITIES */
%macro incidence ;
%do i = 1 %to 12 ;
%let inf = %scan(int*zoo*othbact*hiv*vir*arth*chly*ricket*spiro*helminth*para*late, &i., *) ;
/*intestinal infectious disease*/
%let int = %str("001","002","003","004","005","006","007","008","009") ;
/*zoonotic bacterial disease*/
%let zoo = %str("020","021","022","023","024","025","026","027") ;
/*other bacterial disease*/
%let othbact = %str("030","031","032","033","034","035","036","037","038","039","040","041");
/*hiv*/
%let hiv = %str("042") ;
/*viral diseases accompanied by exanthem*/
%let vir = %str("050","051","052","053","054","055","056","057");
/*arthropod-brone viral disease*/
%let arth = %str("060","061","062","063","064","065","066");
/*other diseases due to viruses and chlamydiae*/
%let chly = %str("070","071","072","073","074","075","076","077","078","079");
/*rickettsioses and otehr arthrpod-borne diseases*/
%let ricket = %str("080","081","082","083","084","085","086","087","088");
/*other spirochetal diseases*/
%let spiro = %str("100","101","102","103","104");
/*helminthiases*/
%let helminth = %str("120","121","123","124","125","126","127","128","129");
/*other infectious and parasitic diseases*/
%let para = %str("130","131","132","133","134","135","136");
/*late effects of infectious and parasitic diseases*/
%let late = %str("137","138","139");
%end ;
/*FLAG PATIENT WITH THE ABOVE MENTIONED COMORBIDITIES ATFTER INDEX_DATE BUT BEFORE PERIOD_STOP*/;
data _04_postindex_&inf. ;
set derived._01_cohort1_final ;
&&inf. =1 ;
where (code in:(&&inf.)) and (index_date le svcdate le period stop) ;
run ;
proc sort data = _04_como ;
by enrolid index_date svcdate ;
run ;
data _04_como1;
set _04_como ;
by enrolid svcdate ;
format first_svcdate_&inf. mmddyy10. ;
if first.enrolid then first_svcdate_&inf. = svcdate ;
run ;
/*FLAG PATIENTS WITH THE ABOVE MENTIONED COMORBIDITES BEFORE THE INDEX_DATE */
%mend incidence;
%incidence;
The log looks like this
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
SYMBOLGEN: Macro variable _SASWSTEMP_ resolves to /data1/home/genesis/sai/.sasstudio/.images/43c9110e-7028-4ff4-bfa0-9eccf8c103bb
SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.
SYMBOLGEN: Macro variable GRAPHINIT resolves to GOPTIONS RESET=ALL GSFNAME=_GSFNAME;
91 option mprint mlogic symbolgen ;
92
93 *STEP 1 ;
94
95 /*CALCUALTING THE NUMBER OF PATIENTS WITH THE APPLICABLE ENDPOINT (ONLY FIRST EVENT TO BE COUNTED) */
96
97 /*FLAG COMORBIDITIES */
98
99 %macro incidence ;
100
101 %do i = 1 %to 12 ;
102
103 %let inf = %scan(int*zoo*othbact*hiv*vir*arth*chly*ricket*spiro*helminth*para*late, &i., *) ;
104
105 /*intestinal infectious disease*/
106 %let int = %str("001","002","003","004","005","006","007","008","009") ;
107
108 /*zoonotic bacterial disease*/
109 %let zoo = %str("020","021","022","023","024","025","026","027") ;
110
111 /*other bacterial disease*/
112 %let othbact = %str("030","031","032","033","034","035","036","037","038","039","040","041");
113
114 /*hiv*/
115 %let hiv = %str("042") ;
116
117 /*viral diseases accompanied by exanthem*/
118 %let vir = %str("050","051","052","053","054","055","056","057");
119
120 /*arthropod-brone viral disease*/
121 %let arth = %str("060","061","062","063","064","065","066");
122
123 /*other diseases due to viruses and chlamydiae*/
124 %let chly = %str("070","071","072","073","074","075","076","077","078","079");
125
126 /*rickettsioses and otehr arthrpod-borne diseases*/
127 %let ricket = %str("080","081","082","083","084","085","086","087","088");
128
129 /*other spirochetal diseases*/
130 %let spiro = %str("100","101","102","103","104");
131
132 /*helminthiases*/
133 %let helminth = %str("120","121","123","124","125","126","127","128","129");
134
135 /*other infectious and parasitic diseases*/
136 %let para = %str("130","131","132","133","134","135","136");
137
138 /*late effects of infectious and parasitic diseases*/
139 %let late = %str("137","138","139");
140
141 %end ;
142
143
144 /*FLAG PATIENT WITH THE ABOVE MENTIONED COMORBIDITIES ATFTER INDEX_DATE BUT BEFORE PERIOD_STOP*/;
145 data _04_postindex_&inf. ;
146 set derived._01_cohort1_final ;
147 &&inf. =1 ;
148 where (code in:(&&inf.)) and (index_date le svcdate le period stop) ;
149 run ;
150
151 proc sort data = _04_como ;
152 by enrolid index_date svcdate ;
153 run ;
154
155 data _04_como1;
156 set _04_como ;
157 by enrolid svcdate ;
158 format first_svcdate_&inf. mmddyy10. ;
159 if first.enrolid then first_svcdate_&inf. = svcdate ;
160 run ;
161
162 /*FLAG PATIENTS WITH THE ABOVE MENTIONED COMORBIDITES BEFORE THE INDEX_DATE */
163
164 %mend incidence;
165 %incidence;
MLOGIC(INCIDENCE): Beginning execution.
MLOGIC(INCIDENCE): %DO loop beginning; index variable I; start value is 1; stop value is 12; by value is 1.
MLOGIC(INCIDENCE): %LET (variable name is INF)
SYMBOLGEN: Macro variable I resolves to 1
MLOGIC(INCIDENCE): %LET (variable name is INT)
MLOGIC(INCIDENCE): %LET (variable name is ZOO)
MLOGIC(INCIDENCE): %LET (variable name is OTHBACT)
MLOGIC(INCIDENCE): %LET (variable name is HIV)
MLOGIC(INCIDENCE): %LET (variable name is VIR)
MLOGIC(INCIDENCE): %LET (variable name is ARTH)
MLOGIC(INCIDENCE): %LET (variable name is CHLY)
MLOGIC(INCIDENCE): %LET (variable name is RICKET)
MLOGIC(INCIDENCE): %LET (variable name is SPIRO)
MLOGIC(INCIDENCE): %LET (variable name is HELMINTH)
MLOGIC(INCIDENCE): %LET (variable name is PARA)
MLOGIC(INCIDENCE): %LET (variable name is LATE)
MLOGIC(INCIDENCE): %DO loop index variable I is now 2; loop will iterate again.
MLOGIC(INCIDENCE): %LET (variable name is INF)
SYMBOLGEN: Macro variable I resolves to 2
MLOGIC(INCIDENCE): %LET (variable name is INT)
MLOGIC(INCIDENCE): %LET (variable name is ZOO)
MLOGIC(INCIDENCE): %LET (variable name is OTHBACT)
MLOGIC(INCIDENCE): %LET (variable name is HIV)
MLOGIC(INCIDENCE): %LET (variable name is VIR)
MLOGIC(INCIDENCE): %LET (variable name is ARTH)
MLOGIC(INCIDENCE): %LET (variable name is CHLY)
MLOGIC(INCIDENCE): %LET (variable name is RICKET)
MLOGIC(INCIDENCE): %LET (variable name is SPIRO)
MLOGIC(INCIDENCE): %LET (variable name is HELMINTH)
MLOGIC(INCIDENCE): %LET (variable name is PARA)
MLOGIC(INCIDENCE): %LET (variable name is LATE)
MLOGIC(INCIDENCE): %DO loop index variable I is now 3; loop will iterate again.
MLOGIC(INCIDENCE): %LET (variable name is INF)
SYMBOLGEN: Macro variable I resolves to 3
MLOGIC(INCIDENCE): %LET (variable name is INT)
MLOGIC(INCIDENCE): %LET (variable name is ZOO)
MLOGIC(INCIDENCE): %LET (variable name is OTHBACT)
MLOGIC(INCIDENCE): %LET (variable name is HIV)
MLOGIC(INCIDENCE): %LET (variable name is VIR)
MLOGIC(INCIDENCE): %LET (variable name is ARTH)
MLOGIC(INCIDENCE): %LET (variable name is CHLY)
MLOGIC(INCIDENCE): %LET (variable name is RICKET)
MLOGIC(INCIDENCE): %LET (variable name is SPIRO)
MLOGIC(INCIDENCE): %LET (variable name is HELMINTH)
MLOGIC(INCIDENCE): %LET (variable name is PARA)
MLOGIC(INCIDENCE): %LET (variable name is LATE)
MLOGIC(INCIDENCE): %DO loop index variable I is now 4; loop will iterate again.
MLOGIC(INCIDENCE): %LET (variable name is INF)
SYMBOLGEN: Macro variable I resolves to 4
MLOGIC(INCIDENCE): %LET (variable name is INT)
MLOGIC(INCIDENCE): %LET (variable name is ZOO)
MLOGIC(INCIDENCE): %LET (variable name is OTHBACT)
MLOGIC(INCIDENCE): %LET (variable name is HIV)
MLOGIC(INCIDENCE): %LET (variable name is VIR)
MLOGIC(INCIDENCE): %LET (variable name is ARTH)
MLOGIC(INCIDENCE): %LET (variable name is CHLY)
MLOGIC(INCIDENCE): %LET (variable name is RICKET)
MLOGIC(INCIDENCE): %LET (variable name is SPIRO)
MLOGIC(INCIDENCE): %LET (variable name is HELMINTH)
MLOGIC(INCIDENCE): %LET (variable name is PARA)
MLOGIC(INCIDENCE): %LET (variable name is LATE)
MLOGIC(INCIDENCE): %DO loop index variable I is now 5; loop will iterate again.
MLOGIC(INCIDENCE): %LET (variable name is INF)
SYMBOLGEN: Macro variable I resolves to 5
MLOGIC(INCIDENCE): %LET (variable name is INT)
MLOGIC(INCIDENCE): %LET (variable name is ZOO)
MLOGIC(INCIDENCE): %LET (variable name is OTHBACT)
MLOGIC(INCIDENCE): %LET (variable name is HIV)
MLOGIC(INCIDENCE): %LET (variable name is VIR)
MLOGIC(INCIDENCE): %LET (variable name is ARTH)
MLOGIC(INCIDENCE): %LET (variable name is CHLY)
MLOGIC(INCIDENCE): %LET (variable name is RICKET)
MLOGIC(INCIDENCE): %LET (variable name is SPIRO)
MLOGIC(INCIDENCE): %LET (variable name is HELMINTH)
MLOGIC(INCIDENCE): %LET (variable name is PARA)
MLOGIC(INCIDENCE): %LET (variable name is LATE)
MLOGIC(INCIDENCE): %DO loop index variable I is now 6; loop will iterate again.
MLOGIC(INCIDENCE): %LET (variable name is INF)
SYMBOLGEN: Macro variable I resolves to 6
MLOGIC(INCIDENCE): %LET (variable name is INT)
MLOGIC(INCIDENCE): %LET (variable name is ZOO)
MLOGIC(INCIDENCE): %LET (variable name is OTHBACT)
MLOGIC(INCIDENCE): %LET (variable name is HIV)
MLOGIC(INCIDENCE): %LET (variable name is VIR)
MLOGIC(INCIDENCE): %LET (variable name is ARTH)
MLOGIC(INCIDENCE): %LET (variable name is CHLY)
MLOGIC(INCIDENCE): %LET (variable name is RICKET)
MLOGIC(INCIDENCE): %LET (variable name is SPIRO)
MLOGIC(INCIDENCE): %LET (variable name is HELMINTH)
MLOGIC(INCIDENCE): %LET (variable name is PARA)
MLOGIC(INCIDENCE): %LET (variable name is LATE)
MLOGIC(INCIDENCE): %DO loop index variable I is now 7; loop will iterate again.
MLOGIC(INCIDENCE): %LET (variable name is INF)
SYMBOLGEN: Macro variable I resolves to 7
MLOGIC(INCIDENCE): %LET (variable name is INT)
MLOGIC(INCIDENCE): %LET (variable name is ZOO)
MLOGIC(INCIDENCE): %LET (variable name is OTHBACT)
MLOGIC(INCIDENCE): %LET (variable name is HIV)
MLOGIC(INCIDENCE): %LET (variable name is VIR)
MLOGIC(INCIDENCE): %LET (variable name is ARTH)
MLOGIC(INCIDENCE): %LET (variable name is CHLY)
MLOGIC(INCIDENCE): %LET (variable name is RICKET)
MLOGIC(INCIDENCE): %LET (variable name is SPIRO)
MLOGIC(INCIDENCE): %LET (variable name is HELMINTH)
MLOGIC(INCIDENCE): %LET (variable name is PARA)
MLOGIC(INCIDENCE): %LET (variable name is LATE)
MLOGIC(INCIDENCE): %DO loop index variable I is now 8; loop will iterate again.
MLOGIC(INCIDENCE): %LET (variable name is INF)
SYMBOLGEN: Macro variable I resolves to 8
MLOGIC(INCIDENCE): %LET (variable name is INT)
MLOGIC(INCIDENCE): %LET (variable name is ZOO)
MLOGIC(INCIDENCE): %LET (variable name is OTHBACT)
MLOGIC(INCIDENCE): %LET (variable name is HIV)
MLOGIC(INCIDENCE): %LET (variable name is VIR)
MLOGIC(INCIDENCE): %LET (variable name is ARTH)
MLOGIC(INCIDENCE): %LET (variable name is CHLY)
MLOGIC(INCIDENCE): %LET (variable name is RICKET)
MLOGIC(INCIDENCE): %LET (variable name is SPIRO)
MLOGIC(INCIDENCE): %LET (variable name is HELMINTH)
MLOGIC(INCIDENCE): %LET (variable name is PARA)
MLOGIC(INCIDENCE): %LET (variable name is LATE)
MLOGIC(INCIDENCE): %DO loop index variable I is now 9; loop will iterate again.
MLOGIC(INCIDENCE): %LET (variable name is INF)
SYMBOLGEN: Macro variable I resolves to 9
MLOGIC(INCIDENCE): %LET (variable name is INT)
MLOGIC(INCIDENCE): %LET (variable name is ZOO)
MLOGIC(INCIDENCE): %LET (variable name is OTHBACT)
MLOGIC(INCIDENCE): %LET (variable name is HIV)
MLOGIC(INCIDENCE): %LET (variable name is VIR)
MLOGIC(INCIDENCE): %LET (variable name is ARTH)
MLOGIC(INCIDENCE): %LET (variable name is CHLY)
MLOGIC(INCIDENCE): %LET (variable name is RICKET)
MLOGIC(INCIDENCE): %LET (variable name is SPIRO)
MLOGIC(INCIDENCE): %LET (variable name is HELMINTH)
MLOGIC(INCIDENCE): %LET (variable name is PARA)
MLOGIC(INCIDENCE): %LET (variable name is LATE)
MLOGIC(INCIDENCE): %DO loop index variable I is now 10; loop will iterate again.
MLOGIC(INCIDENCE): %LET (variable name is INF)
SYMBOLGEN: Macro variable I resolves to 10
MLOGIC(INCIDENCE): %LET (variable name is INT)
MLOGIC(INCIDENCE): %LET (variable name is ZOO)
MLOGIC(INCIDENCE): %LET (variable name is OTHBACT)
MLOGIC(INCIDENCE): %LET (variable name is HIV)
MLOGIC(INCIDENCE): %LET (variable name is VIR)
MLOGIC(INCIDENCE): %LET (variable name is ARTH)
MLOGIC(INCIDENCE): %LET (variable name is CHLY)
MLOGIC(INCIDENCE): %LET (variable name is RICKET)
MLOGIC(INCIDENCE): %LET (variable name is SPIRO)
MLOGIC(INCIDENCE): %LET (variable name is HELMINTH)
MLOGIC(INCIDENCE): %LET (variable name is PARA)
MLOGIC(INCIDENCE): %LET (variable name is LATE)
MLOGIC(INCIDENCE): %DO loop index variable I is now 11; loop will iterate again.
MLOGIC(INCIDENCE): %LET (variable name is INF)
SYMBOLGEN: Macro variable I resolves to 11
MLOGIC(INCIDENCE): %LET (variable name is INT)
MLOGIC(INCIDENCE): %LET (variable name is ZOO)
MLOGIC(INCIDENCE): %LET (variable name is OTHBACT)
MLOGIC(INCIDENCE): %LET (variable name is HIV)
MLOGIC(INCIDENCE): %LET (variable name is VIR)
MLOGIC(INCIDENCE): %LET (variable name is ARTH)
MLOGIC(INCIDENCE): %LET (variable name is CHLY)
MLOGIC(INCIDENCE): %LET (variable name is RICKET)
MLOGIC(INCIDENCE): %LET (variable name is SPIRO)
MLOGIC(INCIDENCE): %LET (variable name is HELMINTH)
MLOGIC(INCIDENCE): %LET (variable name is PARA)
MLOGIC(INCIDENCE): %LET (variable name is LATE)
MLOGIC(INCIDENCE): %DO loop index variable I is now 12; loop will iterate again.
MLOGIC(INCIDENCE): %LET (variable name is INF)
SYMBOLGEN: Macro variable I resolves to 12
MLOGIC(INCIDENCE): %LET (variable name is INT)
MLOGIC(INCIDENCE): %LET (variable name is ZOO)
MLOGIC(INCIDENCE): %LET (variable name is OTHBACT)
MLOGIC(INCIDENCE): %LET (variable name is HIV)
MLOGIC(INCIDENCE): %LET (variable name is VIR)
MLOGIC(INCIDENCE): %LET (variable name is ARTH)
MLOGIC(INCIDENCE): %LET (variable name is CHLY)
MLOGIC(INCIDENCE): %LET (variable name is RICKET)
MLOGIC(INCIDENCE): %LET (variable name is SPIRO)
MLOGIC(INCIDENCE): %LET (variable name is HELMINTH)
MLOGIC(INCIDENCE): %LET (variable name is PARA)
MLOGIC(INCIDENCE): %LET (variable name is LATE)
MLOGIC(INCIDENCE): %DO loop index variable I is now 13; loop will not iterate again.
MPRINT(INCIDENCE): ;
SYMBOLGEN: Macro variable INF resolves to late
MPRINT(INCIDENCE): data _04_postindex_late ;
MPRINT(INCIDENCE): set derived._01_cohort1_final ;
NOTE: Data file DERIVED._01_COHORT1_FINAL.DATA is in a format that is native to another host, or the file encoding does not match
the session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might
reduce performance.
SYMBOLGEN: && resolves to &.
SYMBOLGEN: Macro variable INF resolves to late
MPRINT(INCIDENCE): late =1 ;
SYMBOLGEN: && resolves to &.
SYMBOLGEN: Macro variable INF resolves to late
NOTE: Line generated by the macro variable "INF".
165 late
____
22
76
MPRINT(INCIDENCE): where (code in:(late)) and (index_date le svcdate le period stop) ;
ERROR: Syntax error while parsing WHERE clause.
MPRINT(INCIDENCE): run ;
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant, a datetime constant,
a missing value, -.
ERROR 76-322: Syntax error, statement will be ignored.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK._04_POSTINDEX_LATE may be incomplete. When this step was stopped there were 0 observations and 9
variables.
WARNING: Data set WORK._04_POSTINDEX_LATE was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
MPRINT(INCIDENCE): proc sort data = _04_como ;
ERROR: File WORK._04_COMO.DATA does not exist.
MPRINT(INCIDENCE): by enrolid index_date svcdate ;
MPRINT(INCIDENCE): run ;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
MPRINT(INCIDENCE): data _04_como1;
MPRINT(INCIDENCE): set _04_como ;
ERROR: File WORK._04_COMO.DATA does not exist.
MPRINT(INCIDENCE): by enrolid svcdate ;
SYMBOLGEN: Macro variable INF resolves to late
MPRINT(INCIDENCE): format first_svcdate_late mmddyy10. ;
SYMBOLGEN: Macro variable INF resolves to late
MPRINT(INCIDENCE): if first.enrolid then first_svcdate_late = svcdate ;
MPRINT(INCIDENCE): run ;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK._04_COMO1 may be incomplete. When this step was stopped there were 0 observations and 2 variables.
WARNING: Data set WORK._04_COMO1 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
MLOGIC(INCIDENCE): Ending execution.
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
SYMBOLGEN: Macro variable GRAPHTERM resolves to GOPTIONS NOACCESSIBLE;
193 Any help is appreciated
... View more