From: MAHESH KUMAR PEESARI on
Hi ,


Thanks a lot.


Regards

On Tue, Jan 5, 2010 at 5:47 PM, Murphy Choy <goladin(a)gmail.com> wrote:

> Hi,
>
> Why not use a loop?
>
> %macro merge();
>
> Data alldata;
> Merge
> %do I = 1 %to n;
> Test&i
> %end;
> ;
> By Id;
> Run;
> %mend;
> ------Original Message------
> From: SUBSCRIBE SAS-L Joe H. Smith
> Sender: SAS(r) Discussion
> To: SAS-L(a)LISTSERV.UGA.EDU
> ReplyTo: SUBSCRIBE SAS-L Joe H. Smith
> Subject: Merge n no of Datasets using macros
> Sent: Jan 5, 2010 8:12 PM
>
> HI all,
>
> i have to merge datasets at a time using macros,i should keep incrementing
>
> till the last dataset is merged i have tried to write a macro for merging 3
> datasets
>
> but how can i do it say for 30 datasets..please guide me...
>
> sample code...
>
> %macro sort(no=);
> options mprint mlogic symbolgen;
> %do i=1 %to &no;
> proc sort data=test&i;
> by patid;
> run;
> %end;
> %mend sort;
>
> %sort(no=100);
>
> here in above code i can sort n of datasets at a time.if naming convention
> of
> dataset is like test1,test2,test3,test4....testn
>
> so how can i achieve the same with macro for merging datasets..
>
> For merging below code does only for 3 datasets and not more..
>
>
> %macro merge(x=,y=,z=);
> options symbolgen mprint;
> data test13;
> merge &x &y &z;
> by patid;
> run;
> %mend merge;
>
> %merge(x=test1,y=test2,z=test3);
>
> How to write code more effeciently to merge large no of datasets at a time.
>
> Thanks All
>
>
> Sent from my BlackBerry Wireless Handheld
>
> --
> Regards,
> Murphy Choy
>
> Certified Advanced Programmer for SAS V9
> Certified Basic Programmer for SAS V9
>



--
Thanks,
Mahesh P

*** FAILING TO PLAN IS PLANNING TO FAIL ***