BookmarkSubscribeRSS Feed
kuridisanjeev
Quartz | Level 8

Hi Everyone..

I am Using  the following code..

Proc SQL;

select mail into : email separated by ' " " ' from dump;

quit;

filename report email from ="$$$$$$$$$@*******.com"

to="&email"

...So on..............................

My Question is ,instead of running the SQL Query Every time,I want to store that Email macro Variable permanently..

So ,Is there any way to store the macro variable permanently??

4 REPLIES 4
art297
Opal | Level 21

I've never heard of permanently storing a macro variable, but you could always wrap the code within a SAS macro (that you can store permanently), and then just call the macro whenever it is needed.  That would probably be a better choice, anyhow, as the email base is likely to change over time.

kuridisanjeev
Quartz | Level 8

Thank you art.

Haikuo
Onyx | Level 15

Or you could store it into a permanent text file, and put it back to a macro variable when needed:

%let email=%bquote("alkjdva@ald.com" "lajdfla@ut.com");

data _null_;

file "h:\email.txt";

put "&email";

run;

data _null_;

infile "h:\email.txt" truncover;

input email $char50.;

put email;

if _n_=1 then call symputx('email_new',email);

run;

%put &email_new;

Regards,

Haikuo

Astounding
PROC Star

It's already stored in a temporary data set.  You just need to retrieve it:

proc sql;

create table perm.macrovar as select * from dictionary.macros where name='MY_MACRO_VARIABLE';

quit;

However, if you are dealing with long values, dictionary.macros breaks up your variable into 200-character blocks which will need to be reassembled later.

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!

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.

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
  • 1036 views
  • 1 like
  • 4 in conversation