06-16-2016 06:48 AM
- where is the list coming from (fixed constant, dataset, ....)?
- how should it be used (determines the format of the list)?
06-16-2016 07:17 AM
create a macro variable to store fixed constant integer so that i can pass that in my program.
like for example %Let a= (4, 5, 6) but this is not working
06-16-2016 07:21 AM
"this is not working" is not helpful.
You need to be much more specific, ie by posting the relevant piece of code and the log, and the data as it came out and as you wanted it to be.
06-16-2016 08:50 AM
Why do you say it's not working? It's easy to check. Assuming you added a semicolon:
%let a = (4, 5, 6);
What's actually happening is that the statement works, but you don't know what to do with the result. It is highly likely that you should heed the suggestion about keeping data in data sets instead of macro variables. If you show what you are trying to accomplish, you are pretty sure to get some helpful suggestions.
06-16-2016 07:04 AM
Why? Why not put that list of "data" items in a "data"set that is what "datasets" are for storing data. Macro language is not a replacement for Base SAS - it is a text generation tool.
06-16-2016 10:37 AM
Consider this program (with different numbers so I could use it with SASHELP.CLASS):
title; footnote; %let a=(14,15,16); %put -----> macro variable a is: &a; options mprint symbolgen; proc print data=sashelp.class; title "Looking for Ages &a"; where age in &a; run; data new; x = sum&a; run; proc print data=new; title "adding up values &a in parentheses with sum function"; run; title;
Illustrates 2 completely different uses of &a in 2 different steps. So what the OP wants and what the data looks like and the reason for having the numbers in a macro variable need to be explained so that everybody understands WHAT the OP is trying to accomplish.
The above program generates this in the log and output:
But without a context for the question, it's hard to know which generated code is the desired aim.