| Date: | Wed, 28 Apr 2010 22:56:31 -0400 |
| Reply-To: | SUBSCRIBE SAS-L Dan <deniseyu001@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | SUBSCRIBE SAS-L Dan <deniseyu001@GMAIL.COM> |
| Subject: | Transfer CSV file (xxx.CSV) to flat text file (XXX.txt) |
|---|
Hi. SasLers:
Please help me with the following task. This may involve data _null_ and
put statement. Thanks.
Dan:
%let loc = C;\temp\ ;
data test1 ;
length v1-v4 $20 ;
array clinical (4) v1-v4 ;
do i=1 to 4 ;
if i=3 then clinical(i)='';
else clinical(i)=put(i,8.) ;
end ;
run;
data test2 ;
length v1-v4 $20 ;
array clinical (4) v1-v4 ;
do i=1 to 4 ;
if i=2 then clinical(i)='';
else clinical(i)=put(i,8.) ;
end ;
run;
data test ;
set test1 test2 ;
drop i ;
rename v1=patient v2=visit v3=lborres v4=unit ;
run;
ods listing close ;
ods csv file="&loc.test.csv" ;
proc print data=test noobs; run;
ods csv close ;
ods listing ;
**********************This is the end of the code for CSV file********;
I want to generate a XXX.txt file which is as following:
Line1: patient|visit|lborres|unit Hard Return
Line2: 1|2||4 Hard Return
Line3: 1||3|4 Hard Return
|