LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 2005, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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()
Comments: To: sas-l@uga.edu
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


Back to: Top of message | Previous page | Main SAS-L page