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 (March 1997, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 9 Mar 1997 00:13:02 GMT
Reply-To:     Mitch II <mitchii@AOL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Mitch II <mitchii@AOL.COM>
Organization: AOL http://www.aol.com
Subject:      Re. Embedded Spaces in a String Var

I appreciate the replies to my query. Thank you everyone for your time.

The repies made a couple of suggestions.

One suggested that I should use MISSOVER to prevent SAS from going to a new line. This did not help. I was using column input. The only reason that SAS was attempting to go to a new line, it appears, is that a string with consecutive embedded spaces is treated like two separate string variables. It gets the portion of the string before the spaces in one var and then moves on to the next portion and, it appears, tries to put that in another.

The other suggestion was to use the colon (:) modifier. That won't work, either. As I understand the colon modifier, it reads a variable until it hits a space or it reaches the declared length of the string.

I managed to load the test data by rewriting the input as a comma delimited file (CSV file). I used list input. SAS then read the strings with embedded spaces properly.

Although I can work around the problem, it appears to me that the SAS column input has a bug. If I specify the beginning and ending position of a string, why should SAS care if there are any embedded spaces at all? My guess . . . The algorithm that strips white space off the end of the string is defective. The SAS manual states that one of the advantages of column input is precisely the ability to include embedded spaces in a string. It appears that it doesn't work properly.

If you can use comma separated values for input (or any other delimiter), the list input works fine with multiple embedded spaces in a string. That's the work-around I came up with, anyway.

Thanks again for your help. And SAS, if you're listening, the column input needs a little engineering.

Mitch


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