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 ;

BASUG is hosting free webinars Next up: Mike Sale presenting Data Warehousing with SAS April 10 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

sas-innovate-2024.png

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.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 802 views
  • 0 likes
  • 4 in conversation