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 (October 2004, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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/


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