merging a large number of data sets

Accepted Solution Solved
Reply
Contributor
Posts: 27
Accepted Solution

merging a large number of data sets

Dear all

do you know how to merge a large number of data set without writing all the names?

I have this 40 small bases called base1 to base 40.

i would like to do something like this:

data all; merge base 1 (....to) base 40;run;

thanks


Accepted Solutions
Solution
‎10-23-2013 07:40 AM
Super User
Super User
Posts: 7,039

Re: merging a large number of data sets

You can now use ranges of dataset names, similar to ranges of variable names.

data want ;

  merge base1-base40 ;

run;

But are you sure you want to use MERGE instead of SET?  Merging usually requires a BY statement so that observations are matched properly.  Merging is like pasting together side by side, while setting is like appending the datasets vertically.

View solution in original post


All Replies
Solution
‎10-23-2013 07:40 AM
Super User
Super User
Posts: 7,039

Re: merging a large number of data sets

You can now use ranges of dataset names, similar to ranges of variable names.

data want ;

  merge base1-base40 ;

run;

But are you sure you want to use MERGE instead of SET?  Merging usually requires a BY statement so that observations are matched properly.  Merging is like pasting together side by side, while setting is like appending the datasets vertically.

Contributor
Posts: 27

Re: merging a large number of data sets

it was a MERGE, thanks!

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 199 views
  • 0 likes
  • 2 in conversation