BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

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

3 REPLIES 3
Shmuel
Garnet | Level 18

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.

 

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

works now... thank you

PaigeMiller
Diamond | Level 26

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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