Date: Wed, 27 Oct 2004 09:18:57 -0400
Reply-To: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Subject: Re: Leading spaces in named output
Jim Groeneveld wrote:
> Hi friends,
>
> I just came across something I never yet realized. It is a
> characteristic of (formatted) named output. According to the SAS 8.2
> online docs: "Formatting named output
> [.........]
> To align a formatted value, SAS deletes leading blanks and writes the
> variable value immediately after the equal sign.
> [.........]"
>
> Consider the following example:
>
> DATA _NULL_;
> Text = ' This text has 3 leading and 3 trailing spaces. ';
> LenText = LENGTH(Text);
> PUT LenText=;
> PUT Text=;
> PUT Text= $CHAR.;
> PUT 'Text=' Text;
> PUT 'Text=' Text $CHAR.;
> RUN;
>
> I would have expected the leading spaces to be printed with named
> output, but apparently (in agreement with the way SAS appears to
> intend it) they are not. I do not understand why with a $CHAR. format.
>
> Just for the record.........
>
> Regards - Jim.
>
An easy way to display leading spaces in named output of character variables
is to use the QUOTE. format.
put Text= $QUOTE.;
--
Richard A. DeVenezia
http://www.devenezia.com/
|