Not sure why this code has the errors, could not find out why :
%macro dellob(lobname,lobdate);
PROC SQL;
delete * from reworko.rework&lobname_sumamry
WHERE MONTH=&lobdate;
QUIT;
%mend dellob;
%dellob(0500,'2017-07');
Error message:
delete * from reworko.rework&lobname_sumamry WHERE MONTH=&lobdate; QUIT;
_
22
200
WARNING: Apparent symbolic reference LOBNAME_SUMAMRY not resolved.
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, (, AS, WHERE.
ERROR 200-322: The symbol is not recognized and will be ignored.
Try:
%macro dellob(lobname,lobdate);
PROC SQL;
delete * from reworko.rework&lobname._sumamry
WHERE MONTH=&lobdate;
QUIT;
%mend dellob;
%dellob(0500,'2017-07');
see message in log:
WARNING: Apparent symbolic reference LOBNAME_SUMAMRY not resolved.
Your macro variable is LOBNAME so you need a dot to assing end of macro variable name.
Try:
%macro dellob(lobname,lobdate);
PROC SQL;
delete * from reworko.rework&lobname._sumamry
WHERE MONTH=&lobdate;
QUIT;
%mend dellob;
%dellob(0500,'2017-07');
see message in log:
WARNING: Apparent symbolic reference LOBNAME_SUMAMRY not resolved.
Your macro variable is LOBNAME so you need a dot to assing end of macro variable name.
works now... thank you
The proper syntax for the PROC SQL DELETE statement is:
DELETE FROM tablename ...
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.