%macro LOOP;
%do i=103 %to 103/*&runupto*/ ;
proc sql noprint;
select SYSTEM, FILENAME, TABLE_NAME, ATTRIBUTES, JOIN_TABLE, SECOND , AMOUNT, PROGRAM, LOOKUP
into :SYS, :FILE , :OUTTABLE, :FIELDS, :JOINTABLE, :JOINFIELD, :CADTOTAL, :CHECKER, :LOOK
from DATAVALIDATION where NUMBER=103;
QUIT;
%PUT &FIELDS;
data _NULL_;
if &CHECKER='PROGRAM_CHECK' THEN
CALL EXECUTE(%PROGRAM_CHECK(SYSTEMS=&SYS,FIRST=&FIELDS,SECOND=&JOINFIELD,BALANCE=&CADTOTAL,PARENTTABLE=&FILE,JOINTABLE=&JOINTABLE));
RUN;
/*proc append base=SOURCE data=TABLE2 FORCE;
RUN;*/
%END;
%mend;
ERROR OCCURED:Invalid macro name ;. It should be a valid SAS identifier no longer than 32 characters.
ERROR: A dummy macro will be compiled.
question: I have to run the macro( when the if condition is passed i have to run MACRO_CHECk)
can anyone tell me what is the error for it and what is the correct wat to write it
Thanks in advance
A couple of items for starters ...
Does the value of &CHECKER_PROGRAM really include single quotes?
Trying to add CALL EXECUTE just complicates the program without adding any functionality. You already have a macro running. Why not get rid of the DATA step entirely:
%if &CHECKER=PROGRAM_CHECK %THEN
%PROGRAM_CHECK(SYSTEMS=&SYS,FIRST=&FIELDS,SECOND=&JOINFIELD,BALA
A couple of items for starters ...
Does the value of &CHECKER_PROGRAM really include single quotes?
Trying to add CALL EXECUTE just complicates the program without adding any functionality. You already have a macro running. Why not get rid of the DATA step entirely:
%if &CHECKER=PROGRAM_CHECK %THEN
%PROGRAM_CHECK(SYSTEMS=&SYS,FIRST=&FIELDS,SECOND=&JOINFIELD,BALA
Thank you so much you are a genius... actually in my table "PROGRAM_CHECK " is in character format so I thought in if statement it should be in quotations(i.e %if &CHECKER= 'PROGRAM_CHECK' %THEN .....) but it executed when it is not in the Quotes ..
If possible can you also tell me the reason ?
Thanks again-:)
DATA steps use quotes to compare strings, but macro language does not. Here is a test you can run to become more famliar with the rules:
%macro test;
%let name=siddarth;
%if &name=siddarth %then %put Match #1;
%if &name='siddarth' %then %put Match #2;
%if '&name'='siddarth' %then %put Match #3;
%if "&name"="siddarth" %then %put Match #4;
%mend test;
%test
Of course, you can always invent a few more tests and experiment to become more familiar with the outcomes.
In the context of a DATA step, you would have to resolve macro variables and then understand what the DATA step looks like. Resolving macro variables might generate:
if PROGRAM_CHECK = "PROGRAM_CHECK" then ..
if "PROGRAM_CHECK" = "PROGRAM_CHECK" then ...
if '&PROGRAM_CHECK" = 'PROGRAM_CHECK" then ...
The rules about using quotes or not all depend on whether the proper DATA step syntax would be expecting to see quotes at that point.
Thank You I will try it -:)
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.