Hello,
Thank you for the information provided.
Many time, i need to extract information from one or two dataset then make a new one.
Maybe I don't have the good approach. I have already create a basic code to show what I often need to do.
**********************
Data test; length filename $100; do i=1 to 100; filename=cats('Data',i); output; End; run;
In the dataset test, we have a list of dataset that we could find into a subfolder. In our example, there name goes from Data1 to Data100 but it could be any name.
***********************
From there, I have the macro function ExtractACell, where we put the dataset name of interest, the rownumber and the variable name. Then this value is put into a global varialbe named gvalue.
%macro ExtractACell(dataset=,rownum=, VarName=); data _null_; set &dataset. (obs=&rownum. firstobs=&rownum. keep = &VarName.); call symputx('gvalue', &VarName., 'G'); stop; run; %mend ExtractACell; %ExtractACell(dataset=test,rownum=5, VarName=filename); %put &gvalue.; %symdel gvalue;
*************************************
From that point, I want to create using the macro function test2 to put the following information into the dataset New2
obs
corresponding filename from dataset new (rownumber = obs)
there after, I would like to call another funciton to check if a specific variable is prensent in each dataset from Data1 to Data100.
********************
Here's want I wish to do.
You have into subfolder, a list of sas dataset and I want to put in a single dataset, the name of each of those datasets present into that subfolder, get the number of obs for each dataset then check if a specific variable (ex: vartatou) is present in each dataset , yes or no
the end result will be
Data final;
dataset name obs vartatou
data1 51 yes
data2 26 no
...
data1000 200 yes
Wha'ts the best way to do that.
I though that the use of macro will do the job but it seem it is not the case
What's can we do?
... View more