I have created a macro to go over datasets and pull only variables I require. My issue is when macro switches from one variable to another, temp dataset is not appended to main dataset.
%macro runit;
%do a=1 %to %sysfunc(countw(&varlist,%str( )));
%let varlist_new=%scan(&varlist,&a);
Data work.new (Keep= studyid siteid CCVNAME VARIABLE) ;
set Input.&Dataset;
CCVNAME= "&Dataset";
VARIABLE= "&varlist_new";
run;
%end;
%mend runit;
%runit;
&Varlist value and &dataset values are coming from Metadata file.
I want work.new or a new proc SQL dataset to store all work.new coming out from the do loop.
Thank you in advance.