Below is the code I am using, I wrote some of it and had assistance for the rest, so my knowledge is limited. The program works fine but I need a small adjustment. For the output file I need the name to have 3 digits. So the first file would be auto001.txt currently it is auto1.txt. (I could do this outside of SAS but I am going to be doing this in significant volume and would like to get it output in ready to use format) It is the '&i' in the proc export statement that i need to write as 001 and not 1. Any help much appreciated. %let in=n:\private\my documents\hypercompetition\IEEE submission\Excel Data; %let out=n:\private\my documents\hypercompetition\IEEE submission\Excel Data\output1; %let iterations=2; proc datasets kill noprint;run; %macro RandBetween(min, max); (&min + floor((1+&max-&min)*rand("uniform"))) %mend; %macro iter(filename, i); data rnd; set in; if _n_=1; x = %RandBetween (1, 8844); run; data out; if _n_=1 then set rnd; set in; obs=_n_; if obs lt x then delete; if obs gt x+998 then delete; drop x obs; proc export data=out outfile="&out\&filename.&i..txt" dbms=csv replace; PUTNAMES=NO; run; %mend; %macro main(filename); proc import datafile="&in\&filename..txt" out=in dbms=csv replace; getnames = no; run; %do i=1 %to &iterations; %iter(&filename., &i.); %end; %mend; %main(auto);
... View more