| Date: | Thu, 11 May 2000 09:59:19 -0500 |
| Reply-To: | Jonathan_Goldberg@MASTERCARD.COM |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Jonathan Goldberg <Jonathan_Goldberg@MASTERCARD.COM> |
| Subject: | Re: Infile Help |
| Content-type: | text/plain; charset=us-ascii |
|---|
David Tsao asks:
I have a text file that has variable length characters, for example, the
first line has 132 character, the second 101, third 115,... etc. Is
there any way to read these line in and then 'flow' and 'wrap' them
around to 80 columns variables ? Thanks for helping..
David
Assuming that you want 1 variable of length 80 per output observation, you could
use:
Data output(keep = var80);
infile whatever length = ll truncover; /*the truncover option will cause a
varable that is read past the end of an input record*/
/*to be
assigned whatever data is available, rather than the read continuing on the
next line (flowover)*.
length var80 $ 80; /*or the data step
stopping (stopover)*/
col = 1;
do while (col <= ll);
input @col var80 $char80. @;
output;
col + 80;
end;
run;
If what you want is instead a group of length 80 variables instead of seperate
observations,
substitute assignment to an array for the ouput statement above;
Jonathan
|