Hi,
I have a litte macro that reports the agencies that did not complete a submission.
/*get the names of the agencies that did not report*/
sql noprint;
SELECT agency into:missing_agency separated by ' and '
from agency_list;
quit;
SYMBOLGEN: Macro variable MISSING_agency resolves to agency1 and agency2
/*MACRO TO WRITE THE NAME OF THE NON REPORTERS, IF ANY*/
%macro DidnotReport_AGENCY(missing_agency);
%if &missing_agency = %str() %then %do;
/*%put "Macro Variable is empty";*/
%end;
%else %do;
ods region x=1.0in y=6.5in;
Ods pdf text="^S={font=('Arial' ,10pt, bold ) just=center } Note: %trim(&Missing_agency) did not report this week";
%end;
%mend;
/*RUN THE MACRO*/
%didnotreport_AGENCY(&missing_agency);
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric
operand is required. The condition was: &missing_agency =
ERROR: The macro DIDNOTREPORT_agency will stop executing.
So I figured it had something to do with the fact that there are two non reporters (macro works well with only one non-reporting agency)
so I reasigned the missing agency to "peter"
%let missing_agency = peter;
AND THE LOG SAID:
SYMBOLGEN: Macro variable MISSING_agency resolves to agency1 and agency2
NOTE: A missing equal sign has been inserted after the variable name agency1.
That's interesting!
Why does this happen? And how can I get the name of two agencies to list in the report?
code it this way:
%if "&missing_agency " = " " %then %do;
By that your value testing will be string based comparison.
In you original code the string is put into the macro language. You error message is telling you you have a macro language error.
Think of using SAS macro-s you can modify all kind of strings before it is going (reviewed ) into those nested language interpreters.
code it this way:
%if "&missing_agency " = " " %then %do;
By that your value testing will be string based comparison.
In you original code the string is put into the macro language. You error message is telling you you have a macro language error.
Think of using SAS macro-s you can modify all kind of strings before it is going (reviewed ) into those nested language interpreters.
Hi,
The word AND is tripping up the implied %eval() in the %IF statement. You can add macro quoting:
%if %superq(missing_agency)=%str() ...
Or for a utility macro %IsBlank that does this check for you, see:
http://changchung.com/download/022-2009.pdf
Thanks so much..
Bruce
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.