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 ...
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.