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 ...
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.