Hello,
I have the following code. There is an error on the log window when running.
%let i=(&rr + 1);
%let rr=%eval(&i);
proc sql;
create table inpcr&rr as
select studysite,caseid,scrdate,inptadmitdt,inptdischargedt, intck('day',inptadmitdt, inptdischargedt) as c_los
from ds2INP
where scrdate ^=. and inptadmitdt ^=. and inptdischargedt ^=. and inptadmitdt ne '09SEP9999'd and inptdischargedt ne '09SEP9999'd
and (c_los<0 or c_los>100)
order by studysite,caseid;
%let inp_&rr.a=%str(Missing length of stay or extreme value [negative or >100 days]);
ods proclabel "Check &rr:&&&inp_&rr.a";
data inpcr&rr;
set inpcr&rr;
*if inptdischargedt='09SEP9999'd then delete;
var1="scrdate="||trim(left(put(scrdate,mmddyy10.)))
||', '||"inptadmitdt="||trim(left(put(inptadmitdt,mmddyy10.)))
||', '||"inptdischargedt="||trim(left(put(inptdischargedt,mmddyy10.)))
||', '||"c_los="||trim(left(put(c_los,3.)));
format studysite studysite.;
/* site confirmed with checks */
if caseid in ('E1'.'K8','R0','ER') then delete;
run;
%createINP;
MPRINT(ARIINPCHART): ; MPRINT(ARIINPCHART): proc sql; MPRINT(ARIINPCHART): create table inpcr26 as select studysite,caseid,scrdate,inptadmitdt,inptdischargedt, intck('day',inptadmitdt, inptdischargedt) as c_los from ds2INP where scrdate ^=. and inptadmitdt ^=. and inptdischargedt ^=. and inptadmitdt ne '09SEP9999'd and inptdischargedt ne '09SEP9999'd and (c_los<0 or c_los>100) order by studysite,caseid; ERROR: The following columns were not found in the contributing tables: c_los. MPRINT(ARIINPCHART): ods proclabel "Check 26:Missing length of stay or extreme value [negative or >100 days]"; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE SQL used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
MPRINT(ARIINPCHART): data inpcr26; MPRINT(ARIINPCHART): set inpcr26; MPRINT(ARIINPCHART): *if inptdischargedt='09SEP9999'd then delete; MPRINT(ARIINPCHART): var1="scrdate="||trim(left(put(scrdate,mmddyy10.))) ||', '||"inptadmitdt="||trim(left(put(inptadmitdt,mmddyy10.))) ||', '||"inptdischargedt="||trim(left(put(inptdischargedt,mmddyy10.))) ||', '||"c_los="||trim(left(put(c_los,3.))); MPRINT(ARIINPCHART): format studysite studysite.; ERROR: All variables in array list must be the same type, i.e., all numeric or character. MPRINT(ARIINPCHART): if caseid in ('E1'.'K8','R05','ER') then delete; MPRINT(ARIINPCHART): run;
NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.INPCR26 may be incomplete. When this step was stopped there were 0 observations and 7 variables. WARNING: Data set WORK.INPCR26 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
... View more