Prev: Termination due to Floating Point Exception with Proc NLMixed for a count data set
Next: Merge n no of Datasets using macros
From: "SUBSCRIBE SAS-L Joe H. Smith" on 5 Jan 2010 07:12 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 |