Ask Your Question
0

What is the method of including a list of macro variables as a column in a SAS dataset?

asked 2022-09-13 11:00:00 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-03-30 10:00:00 +0000

bukephalos gravatar image

To include a list of macro variables as a column in a SAS dataset, you can use the %let statement to create the macro variables, then use the data step to create a dataset and use the macro variable values as values for the column. Here is an example:

%let var1 = 10; %let var2 = 20; %let var3 = 30;

data mydataset; input macrovar $; datalines; &var1 &var2 &var3 ; run;

This will create a dataset named "mydataset" with one column named "macrovar" and three rows containing the values of the macro variables "var1", "var2", and "var3".

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-09-13 11:00:00 +0000

Seen: 11 times

Last updated: Mar 30 '23