DATA Step, Macro, Functions and more

Macro

Accepted Solution Solved
Reply
Frequent Contributor
Frequent Contributor
Posts: 119
Accepted Solution

Macro

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.

 


Accepted Solutions
Solution
‎08-21-2017 02:10 PM
Trusted Advisor
Posts: 1,831

Re: Macro

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.

 

View solution in original post


All Replies
Solution
‎08-21-2017 02:10 PM
Trusted Advisor
Posts: 1,831

Re: Macro

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.

 

Frequent Contributor
Frequent Contributor
Posts: 119

Re: Macro

works now... thank you

Respected Advisor
Posts: 2,802

Re: Macro

[ Edited ]

The proper syntax for the PROC SQL DELETE statement is:

 

DELETE FROM tablename ...

 

http://documentation.sas.com/?cdcId=pgmmvacdc&cdcVersion=9.4&docsetId=sqlproc&docsetTarget=n0wvt1t0e...

--
Paige Miller
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 231 views
  • 7 likes
  • 3 in conversation