BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi can anyone let me know how to clear variable values during a SAS session without closing the session.

Thanks and Regards
Yuvraj
10 REPLIES 10
BrunoSilva
Quartz | Level 8
Hello,

Use %SYMDEL "Deletes the specified variable or variables from the macro global symbol table."

i hope it help 😄
deleted_user
Not applicable
Thanks Bruno for the suggestion ,
but I am looing for something which can be used to Re-intialize all the variables in an SAS session to NULL values.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
SAS maintains a view called SASHELP.VMACRO, which you can use/reference to generate %LET statements for this purpose.

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
Thank you scott, I checked the Macro and it gave me all the Automatic variables and their values.
As suggested by you, we can use a %LET statement and assign NULL values to them.

but isn't there any thing that can do this automatically without using the %LET statement.

--Thanks
Yuvraj
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Just to clarify your question again, please -- you are using SAS (either interactively or batch) and at some point in your application processing you want SAS to change all of your SAS MACRO VARIABLES to be BLANK (essentially no value), correct? I know of no SAS feature/function to convert all current, user-defined SAS macro variables to blank.

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
I wasn't sure too of any feature that would do it but they asked me the same question in the interview. Message was edited by: yuvi
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Your reference to "clear variable values" could be considered somewhat ambiguous, as I eluded to. The term "variable values" could either mean SAS dataset variables or SAS macro variables.

Scott Barry
SBBWorks, Inc.
data_null__
Jade | Level 19
Is this what you mean?

[pre]
data delete;
set sashelp.vmacro;
where scope eq: 'G' and name ne: 'SYS';
run;
data _null_;
set delete;
call symdel(name);
run;
[/pre]
deleted_user
Not applicable
I guess this would solve the question of clearing the Macro variable values during an SAS session.

Thanks Scott and data_null_ for your help Message was edited by: yuvi
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
As was stated in an early reply, %SYMDEL can be used to delete one or more "global" macro variable - it does not blank out macro variables.

Scott Barry
SBBWorks, Inc.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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