Hi all, I use the following code to separate a large data file into multiple smaller ones. For example, breaking down by the variable rep. libname saswork 'C:\Documents and Settings\comp$uss\Desktop\SAS'; data test; input x y z group rep; datalines; 1 2 3 1 1 2 2 4 1 1 1 1 3 2 1 2 2 8 3 2 3 3 2 4 2 3 4 5 4 2 3 5 6 5 3 2 1 1 5 3 2 3 4 5 4 ; proc sort data=test out=saswork.test; by rep; run; %Macro Split; proc sql noprint; select distinct rep into :w1 through :w9999 from test; %let nw = &sqlobs; data %do i=1 %to &nw; saswork.out&&w&i %end; ; set test; select (rep); %do i=1 %to &nw; when (&&w&i) output saswork.out&&w&i; %end; end; Using this code, I can get multiple dataset: out1 out2 .... But, what I really want to do is to save these files as ascii files. In other words, I want to create out1.txt out2.txt ... simultaneously. I have tried a few ways, but so far to no avail. Can anyone help me with this? Thanks! SQ
... View more