BookmarkSubscribeRSS Feed
fredbell
Fluorite | Level 6
Hello

I would like to define a list like this
var Jan_10 Feb_10 Mar_10 Apr_10 May_10 Jun_10 Jul_10;

then call it from any program when needed, how can i do this simply?

Fred
3 REPLIES 3
RickM
Fluorite | Level 6
Hi,

Without knowing more about what exactly you want to accomplish you could just put the variables in a macro variable to be used in var statements across procs. Something like

%let vars=Jan_10 Feb_10 Mar_10 Apr_10 May_10 Jun_10 Jul_10;

then in your program, lets say in proc print, you would use

proc print data=dsn;
var &vars;
run;
fredbell
Fluorite | Level 6
Thanks RickM, i had attempted this myself and it did not work but it did this time.

Crazy but often it does not work until you show someone, then it does and makes you look like a clown.

Thanks again

Fred
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Investigate using the old-style MACRO statement or MACRO variable for simple context substitution. Samples are listed below:

%LET XXXX = %QUOTE( * this is a comment; );

MACRO _YYYY
* this is also a comment;
%

The first example is referenced by &XXXX in your program.

The second example is referenced by the character string _YYYY -- in this case, the SAS code parser sees the MACRO statement declaration and then will make the substitution in its place.

Scott Barry
SBBWorks, Inc.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 755 views
  • 0 likes
  • 3 in conversation