BookmarkSubscribeRSS Feed
anilgvdbm
Quartz | Level 8

Hi All,

 

I have a datasets 3000 lets say test0001 to test3000 and the variable names are same in all the datasets. I want to append all 3000 files in to one file.

 

Please suggest me any short simple way to do this task.

 

 

Regards,

Anil

 

2 REPLIES 2
Kurt_Bremser
Super User

proc append can only handle one dataset to append.

But you can use a datastep with wildcards:

data basetest;
input x;
cards;
1
;
run;

data add0001;
input x;
cards;
2
;
run;

data add0002;
input x;
cards;
3
;
run;

data basetest;
set
  basetest
  add:
;
run;
RW9
Diamond | Level 26 RW9
Diamond | Level 26

First off, don't write all in upper case - I will change the subject.

Secondly why do you have 3000 datasets all the same, sounds like your running some procedure over data and outputting to separate datasets - this is not an efficient methodology and then leads to questions like yours.  Look up by group processing.  In your original data create a grouping variable, then do your procedure with the by group - it is faster, less coding, less disk space, and simpler to work with.  E.g. I want to do means on all groups of age 1-10, 11-20, 20+

data inter;
  set have;
  length group $20;
  if 1 <= age <= 10 then group="Group 1";
  else if 11 <= age <= 20 then group="Group 2";
  else group="Group 3";
run;

proc means data=inter;
  by group;     /* key line */
  var weight;
  output out=want n=n mean=mean;
run;

This will process one dataset, by the given group, and produce one dataset with all the output needed.

If you have another point, please give full details.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 3317 views
  • 0 likes
  • 3 in conversation