|
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On
> Behalf Of pinu
> Sent: Tuesday, April 28, 2009 11:25 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: How to create a dataset by appending a single (i.e
> same) dataset multiple times.??
>
> There is a dataset A as;
> id num
> 1 11
> 2 22
> 3 33
> Now I want to create a dataset named A which will consists of records
> from A appended 100 times.
> Sample o/p of Dataset A will be:
> 1 11
> 2 22
> 3 33
> 1 11
> 2 22
> 3 33
> ..
> ..
> ..
> ..
> Is there any other way than using the set statement and writing A 100
> times after that
> e.g. . data A;
> set A A A . .... ..................;
> run;
You could try something like the following,
data a;
input id num;
cards;
1 11
2 22
3 33
;
run;
%macro appendN(file,n);
%do i = 1 %to &n;
proc append base=want data=&file;
run;
%end;
%mend;
%appendN(a,100)
Hope this is helpful,
Dan
Daniel Nordlund
Bothell, WA USA
|