BookmarkSubscribeRSS Feed
hdg
Obsidian | Level 7 hdg
Obsidian | Level 7

Hello, I have a list of macro variables specified as below

proc sql noprint;

select count(distinct date) into :Num_Dates from &ds1;

select distinct date into : Date1-:Date%left(&Num_Dates)

from &ds1;

quit;

Is there a way to delete Date1 etc without having to list of all of them I normally use %symdel Thank you!

4 REPLIES 4
jakarman
Barite | Level 11

Put your processing in a macro. All defined macro variables will  become in the scope local.

When the macro execution stops all local variables are deleted automatic. Nothing to bother about deleting them.

---->-- ja karman --<-----
hdg
Obsidian | Level 7 hdg
Obsidian | Level 7

yes I am doing that but just wanted to know if there was a way for my own reference Thanks!

data_null__
Jade | Level 19

There is a dictionary view and data step view of macro variables.  You can use that to create the list of variable names you want to delete.

Quentin
Super User

Here's an approach like _null_ suggested:

data _null_ ;

  set sashelp.vmacro ;

  where scope='GLOBAL' and offset=0 and name like "DATE%" ;

  call execute('%nrstr(%%)symdel '||trim(left(name))||';') ;

run ;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 1665 views
  • 0 likes
  • 4 in conversation