Hello,
i want to brings sets together into one data in macro. I have 1064 sets like zm_&next_name and i want to brings them into one data for example ----> data CramerSet;
In macro or outside this macro?
it doesn't matter.
This will take all tables starting with ZM_ .
Ok, I'll check, I have another question. If I have over 1000 sets in one dataset, what should I do to avoid printing those over 1000 sets in the output data?
@Piotr900k wrote:
Ok, I'll check, I have another question. If I have over 1000 sets in one dataset, what should I do to avoid printing those over 1000 sets in the output data?
I'm afraid you have to describe what you mean by "printing over those 1000 sets".
If you are referring to a Set statement in a data step there is no "printing over" going on. It is adding records from each data set.
You can have the same data set on the Set statement multiple times, it just appends the data set each time.
What you could do, if that's what you want, is:
data INPUT/view=INPUT;
set ZM_: indsname=INDS;
run;
proc means data=INPUT;
class INDS:
...
run;
No macro needed. Process all the tables in one go and create a single output.
I have my macro to change variables, and i want to do one data set which include this changed variables, because i need to calculate v-cramer after
>I have my macro to change variables, and i want to do one data set which include this changed variables,
How about something like this:
data _null_;
set ZM_: (obs=1) indsname=INDS; * get all the table names;
if INDS ne lag(INDS) ; * one process by table ;
VAR=substr(INDS,8); * remove WORK.ZM_ to find the variable name; * extract the analysis variable nane;
call execute(' proc means data='||INDS||' nway; id INDS ; out=SUM q1=q1 q2=q2 q3=q3; var ' || VAR
||';proc append data=SUM base=WANT; run;'); * run statistics;
run;
I suspect the 1000 tables are created from a process that could easily create less of a messy output.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.