01-11-2016 10:45 PM
Hi, I have a dataset that contains multiple records. I need to write it out to a flat file in such a way that all records are written in first record. (same row as header). Below is the code I wrote. But, my job is truncating the file and not outputting all records as I need.
filename credit "/user/ccc/xx/LTR.txt";
file credit dlm="|" dsd lrecl=60000;
if _n_=1 then do;
var1 var2 var3 var4 var5 var6 var7;
NOTE: 1 record was written to the file CREDIT.
The minimum record length was 90.
The maximum record length was 90.
NOTE: There were 7 observations read from the data set WORK.TEST.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
user cpu time 0.00 seconds
system cpu time 0.01 seconds
OS Memory 13352k
Timestamp 1/11/2016 10:41:44 PM
Page Faults 0
Page Reclaims 548
Page Swaps 0
Voluntary Context Switches 19
01-11-2016 11:33 PM
Try something like :
filename credit "&sasforum.\datasets\credit.txt"; data _null_; file credit lrecl=60000; put 'name|sex|age|height|weight|' @; do while(not done); set sashelp.class end=done; put (name sex age height weight) (+(-1)"|") @; end; stop; run;