BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ybz12003
Rhodochrosite | Level 12

Hello,

I have error messages shown on the log screen.  Please help.

%macro vvv(ooo);
%do ooo=1 %to 10;
%let i=(&rr + 1);
%let rr=%eval(&i);

data eddisdx&ooo;
set ds2ed (keep=studysite scrdate caseid eddisdx&ooo);
if eddisdx&ooo ne ' ';
/*R51 headache ok through FY20*/
/*M358 ok through FY20 revised for FY21 to M3581 (MIS-C) and M3589*/
if eddisdx&ooo in('999.9999','999..999','999.999','U07.1','U07.0','999.99','R51','M358') then delete;
icd_10_cm=upcase(compress(eddisdx&ooo,',.[]-/'));
run;

proc sort data=eddisdx&ooo; by icd_10_cm; run;

data edcr&rr (keep=studysite scrdate caseid eddisdx&ooo icd_10_cm);
merge eddisdx&ooo (in=a) icd_10_cm (in=b);
by icd_10_cm;
if a=1 and b ne 1;
run;

proc sort data=edcr&rr; by studysite caseid; run;

%let edcrf_&rr=%str(Discharge diagnosis [eddisdx&ooo.] does not match ICD-10-CM code list);

ods proclabel "Check &rr:&&edcrf_&rr";

data edcr&rr;
set edcr&rr;
var1='scrdate='||trim(left(put(scrdate,mmddyy10.)))
||', '||"eddisdx&ooo.="||trim(left(put(eddisdx&ooo,$20.)));
||', '||"eddisdx&ooo. without special symbol="||trim(left(put(icd_10_cm,$20.)));
format studysite studysite.;
run;

%createchr;
%end;

%mend vvv;
%vvv;
MPRINT(ARIEDCHART):  ;
MPRINT(VVV):   data eddisdx1;
MPRINT(VVV):   set ds2ed (keep=studysite scrdate caseid eddisdx1);
MPRINT(VVV):   if eddisdx1 ne ' ';
MPRINT(VVV):   if eddisdx1 in('999.9999','999..999','999.999','U07.1','U07.0','999.99','R51','M358')
then delete;
MPRINT(VVV):   icd_10_cm=upcase(compress(eddisdx1,',.[]-/'));
MPRINT(VVV):   run;

NOTE: There were 6175 observations read from the data set WORK.DS2ED.
NOTE: The data set WORK.EDDISDX1 has 5852 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds


MPRINT(VVV):   proc sort data=eddisdx1;
MPRINT(VVV):   by icd_10_cm;
MPRINT(VVV):   run;

NOTE: There were 5852 observations read from the data set WORK.EDDISDX1.
NOTE: The data set WORK.EDDISDX1 has 5852 observations and 5 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


MPRINT(VVV):   data edcr2 (keep=studysite scrdate caseid eddisdx1 icd_10_cm);
MPRINT(VVV):   merge eddisdx1 (in=a) icd_10_cm (in=b);
MPRINT(VVV):   by icd_10_cm;
MPRINT(VVV):   if a=1 and b ne 1;
MPRINT(VVV):   run;

NOTE: There were 5852 observations read from the data set WORK.EDDISDX1.
NOTE: There were 73982 observations read from the data set WORK.ICD_10_CM.
NOTE: The data set WORK.EDCR2 has 1 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


MPRINT(VVV):   proc sort data=edcr2;
MPRINT(VVV):   by studysite caseid;
MPRINT(VVV):   run;

NOTE: There were 1 observations read from the data set WORK.EDCR2.
NOTE: The data set WORK.EDCR2 has 1 observations and 5 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


MPRINT(VVV):   ods proclabel "Check 2:Discharge diagnosis [eddisdx1] does not match ICD-10-CM code
list";
MPRINT(VVV):   data edcr2;
MPRINT(VVV):   set edcr2;
180: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where
      the error has occurred.
ERROR 180-322: Statement is not valid or it is used out of proper order.
MPRINT(VVV):   var1='scrdate='||trim(left(put(scrdate,mmddyy10.))) ||',
'||"eddisdx1="||trim(left(put(eddisdx1,$20.)));
MPRINT(VVV):   ||', '||"eddisdx1 without special symbol="||trim(left(put(icd_10_cm,$20.)));
MPRINT(VVV):   format studysite studysite.;
MPRINT(VVV):   run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.EDCR2 may be incomplete.  When this step was stopped there were 0
         observations and 6 variables.
WARNING: Data set WORK.EDCR2 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(CREATECHR):   proc print data = edcr2 noobs label;
MPRINT(CREATECHR):   by studysite;
MPRINT(CREATECHR):   title2 "Check 2:Discharge diagnosis [eddisdx1] does not match ICD-10-CM code
list";
MPRINT(CREATECHR):   run;
NOTE: There were 1 observations read from the data set WORK.EDCR2.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


MPRINT(CREATECHR):   proc format CNTLOUT=fmt2;
MPRINT(CREATECHR):   value ed (default=255) 2="2:Discharge diagnosis [eddisdx1] does not match
ICD-10-CM code list";
NOTE: Format ED is already on the library WORK.FORMATS.
NOTE: Format ED has been output.
MPRINT(CREATECHR):   run;
NOTE: PROCEDURE FORMAT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

NOTE: The data set WORK.FMT2 has 15 observations and 21 variables.

MPRINT(CREATECHR):   data fmt2_;
MPRINT(CREATECHR):   set fmt2;
MPRINT(CREATECHR):   if FMTNAME ="ED";
MPRINT(CREATECHR):   run;

NOTE: There were 15 observations read from the data set WORK.FMT2.
NOTE: The data set WORK.FMT2_ has 1 observations and 21 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

It's hard to see this macro doing anything useful. A simplified version produces errors right at the beginning.

 

%macro vvv(ooo);
%do ooo=1 %to 10;
%let i=(&rr + 1);
%let rr=%eval(&i);
%end;
%mend;
%vvv()
WARNING: Apparent symbolic reference RR not resolved.
WARNING: Apparent symbolic reference RR not resolved.
WARNING: Apparent symbolic reference RR not resolved.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: (&rr + 1)
ERROR: The macro VVV will stop executing.

So, you must be running different code ... sure would be nice if you could share the actual code with us, or if you can't provide us the actual code, if you would TEST the parts of your code that are supposedly working before you show it to us. Testing and providing us with working code (except for the question you ask) is a good thing, in fact I consider it mandatory, not optional.

 

The errors you do get

 

ERROR 180-322: Statement is not valid or it is used out of proper order.
MPRINT(VVV):   var1='scrdate='||trim(left(put(scrdate,mmddyy10.))) ||',
'||"eddisdx1="||trim(left(put(eddisdx1,$20.)));
MPRINT(VVV):   ||', '||"eddisdx1 without special symbol="||trim(left(put(icd_10_cm,$20.)));
MPRINT(VVV):   format studysite studysite.;
MPRINT(VVV):   run;

 

are because you have inserted an un-necessary semi-colon in the code above.

 

 

 

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

It's hard to see this macro doing anything useful. A simplified version produces errors right at the beginning.

 

%macro vvv(ooo);
%do ooo=1 %to 10;
%let i=(&rr + 1);
%let rr=%eval(&i);
%end;
%mend;
%vvv()
WARNING: Apparent symbolic reference RR not resolved.
WARNING: Apparent symbolic reference RR not resolved.
WARNING: Apparent symbolic reference RR not resolved.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: (&rr + 1)
ERROR: The macro VVV will stop executing.

So, you must be running different code ... sure would be nice if you could share the actual code with us, or if you can't provide us the actual code, if you would TEST the parts of your code that are supposedly working before you show it to us. Testing and providing us with working code (except for the question you ask) is a good thing, in fact I consider it mandatory, not optional.

 

The errors you do get

 

ERROR 180-322: Statement is not valid or it is used out of proper order.
MPRINT(VVV):   var1='scrdate='||trim(left(put(scrdate,mmddyy10.))) ||',
'||"eddisdx1="||trim(left(put(eddisdx1,$20.)));
MPRINT(VVV):   ||', '||"eddisdx1 without special symbol="||trim(left(put(icd_10_cm,$20.)));
MPRINT(VVV):   format studysite studysite.;
MPRINT(VVV):   run;

 

are because you have inserted an un-necessary semi-colon in the code above.

 

 

 

--
Paige Miller
Reeza
Super User
Also, that data set isn't generated by this code, it's from an external source (changing in place is dangerous usually, more so in this usage).

sas-innovate-2024.png

 

Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.

 

Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer. 

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 369 views
  • 1 like
  • 3 in conversation