Date: Thu, 22 May 2008 05:56:22 -0700
Reply-To: Laptop765@GMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Laptop765@GMAIL.COM
Organization: http://groups.google.com
Subject: Re: Automatic Trim on Input?
Content-Type: text/plain; charset=ISO-8859-1
On May 21, 3:47 pm, BD9...@ATT.COM ("Duell, Bob") wrote:
> You are using standard column input, which trims leading blanks.
>
> Change to "formatted" input and use the $CHAR informat with pointer
> control. For example:
>
> DATA newdata;
> INFILE infile;
> INPUT @1 first $char6.
> @7 second $char4.
> @11 third $char10.
> @21 fourth $char26.
> @47 fifth $char53.;
> RUN;
>
> That should do it!
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SA...@LISTSERV.UGA.EDU] On Behalf Of
>
> Laptop...@GMAIL.COM
> Sent: Wednesday, May 21, 2008 11:50 AM
> To: SA...@LISTSERV.UGA.EDU
> Subject: Automatic Trim on Input?
>
> Say I have the following input:
> DATA newdata;
> INFILE infile;
> INPUT first $ 1-6
> second $ 7-10
> third $ 11-20
> fourth $ 21-46
> fifth $ 47-100
> RUN;
>
> I manipulate the data for a while and then go to output it again.
> When I output it (using same field numbers), I find that SAS has re-
> arranged the layout of the fields... It looks like the data has been
> trimmed and left-justified. This turns out to be a major problem
> considering my data files are laid out by columns and the larger
> columns (fourth and fifth) are actually many sub-fields whose column
> alignment need to stay where they are. Is there any way to turn this
> off and keep any trailing/leading spaces?
Worked perfectly! Thanks!
|