Date: Tue, 25 May 2004 14:51:58 -0400
Reply-To: Peter Crawford2 <peter.crawford@BLUEYONDER.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Peter Crawford2 <peter.crawford@BLUEYONDER.CO.UK>
Subject: Re: Making external file with the same length as the original SAS
file
You might be getting overflow lines for every row !
That could increase your file size ( lines, but not max line width).
When generating a pipe delimited file, you might want to use
instead of this style of coding, the filename statement DSD option
and request pipe delimiters, like
data mydata;
retain <list in order, the variables you want in your output file> ;
set jan.survey12;
file 'file1.txt' DSD DLM= '|' lrecl=10000 ;
put ( <firstVariableWanted> -- <lastVariableWanted> )( : ) ;
run;
The DSD option places a delimiter between each variable. The
default is comma, but the dlm= option allows pipemark (|) to
be specified.
Additionally, the DSD option protects and delimiter embedded in
data, by quoting the value on the output file. This is the standard
for such situations. In support of that standard, there is a
similar rule to protect any quotes that occur in data.
Of course, since what you are generating with the code below is
very standard, there is a sas procedure to support it. Have a
look at the online-doc for proc export
Good Luck
Peter Crawford
Crawford Software Consultancy Limited
On Tue, 25 May 2004 12:42:04 -0500, Duck-Hye Yang <dyang@CHAPINHALL.ORG>
wrote:
>Hi,
>I wanted to make an external file. I tried to use the following code.
>
>data mydata;
>set jan.survey12;
>
>file 'file1.txt' ;
>put
>
>SURVEYID '|' COUNTY '|' ORG_NAME '|' PHONE '|' ADDRESS '|' CITY '|'
STATE '|'
>ZIP '|' FAX '|' URL '|' RSPNDNT '|' R_PHONE '|' R_TTY '|' R_EMAIL '|'
P_NM_TTL '|'
>Q1B1 '|'
>Q1B2 '|'
>Q1B3 '|'
>Q1B4 '|'
>
>there are alot more variables.
>
>My problem is that the record length of the newly created file
(file1.txt) increased from 1,011 (of the original file) to 2,022.
>How can I get the file that contains the same number of records as the
orignal file?
>
>Thanks,
>
>Duckhye
|