Storing Macro Variable Values to a Dataset

This tutorial explains how to store macro variable values to a data set.
%macro storemacroval;
proc sql noprint;
select name into: nvar separated by " "
from dictionary.columns
where LIBNAME = "SASHELP"
and MEMNAME = "CLASS"
and type = "num";
quit;
%let cntvar = %sysfunc(countw(&nvar));
data output;
length List $ 32;
%do i=1 %TO &cntvar.;
%let varN =%scan(&nvar,&i);
List = "&varN";
output;
%end;
run;
%mend;
%storemacroval;

About Author:

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has close to 7 years of experience in data science and predictive modeling. During his tenure, he has worked with global clients in various domains like retail and commercial banking, Telecom, HR and Automotive.


While I love having friends who agree, I only learn from those who don't.

Let's Get Connected: Email | LinkedIn

Get Free Email Updates :
*Please confirm your email address by clicking on the link sent to your Email*

Related Posts:

0 Response to "Storing Macro Variable Values to a Dataset"

Post a Comment

Next → ← Prev