- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 09-02-2010 09:52 AM
(943 views)
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
Crazy but often it does not work until you show someone, then it does and makes you look like a clown.
Thanks again
Fred
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
%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.