LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 9 Jul 2006 20:12:34 -0400
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:      Re: Combine data sets

On Sun, 9 Jul 2006 15:46:21 -0700, Li Zhang <zhanglitt@YAHOO.COM> wrote:

>I have 100 data sets, namely temp_1 .. temp_100, all >of which have the same variables that are in the same >order. I'd like to combine them together to form a >single data set. > >I wrote a tiny Macro which looks ugly, is there any >better way to do it? > >Thank you > > > >%Macro Combine; >data M; >set temp_1; >run; > >%do i = 2 %to 100; >data M; >set M temp_&i.; >run; >%end; >%Mend; > >%Combine;

What's ugly is the log, because there will be 100 DATA steps, where only one is needed.

It's also inefficient, as the observations in TEMP_1 will be passed 99 times more than necessary, those in TEMP_2 98 times more, etc.

Try

%Macro Combine; data M; set %do i = 1 %to 100; temp_&i. %end; ; run; %Mend;

%Combine


Back to: Top of message | Previous page | Main SAS-L page