Date: Tue, 29 Nov 2005 13:40:45 -0800
Reply-To: james.p.campbell@GMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: james.p.campbell@GMAIL.COM
Organization: http://groups.google.com
Subject: Space omitted from substr()
Content-Type: text/plain; charset="iso-8859-1"
Hello --
I have a file with fixed-width data, and the variables are padded with
spaces, for example
Value1 Value2 Value3
Val_a Val_b Val_c
I read in the file using an infile statement:
infile line $27.;
and I want to extract the contents of the first variable. However,
using substr(line,1,9), gives me only "Value1" and "Val_a" without the
trailing spaces. How can I preserve them?
As a note, simply breaking the data apart at the infile, e.g.
infile var1 $9. var2 $9. var3 $9.;
seems to have the same problem.
James
|