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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 863 views
  • 0 likes
  • 3 in conversation