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 2010, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 26 Nov 2010 10:21:55 -0800
Reply-To:   "Jack F. Hamilton" <jfh@STANFORDALUMNI.ORG>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Jack F. Hamilton" <jfh@STANFORDALUMNI.ORG>
Subject:   Re: $varying9. and strange input statement
Comments:   To: bbser2009 <bbser2009@GMAIL.COM>
In-Reply-To:   <001c01cb8d93$13ef2620$3bcd7260$@com>
Content-Type:   text/plain; charset=us-ascii

The example you show below is straight out of the documentation:


You should send email to asking them to improve the documentation if you don't think it's sufficient. I agree that the documentation is a bit murky, but working through the two examples should make it clear.

"input x 1." reads "3" from the input line and stores it as the number 3 in the variable X.

"name $varying9. x" reads the next portion of the input line into variable NAME. How much does it read? The number of characters specified in variable X. You just set the value of X to 3, so it reads 3 characters. If x equals 3, then "$varying9. x" reads 3 characters. If x equals 8, "$varying9. x" reads 8 characters.

On Nov 26, 2010, at 9:55 , bbser2009 wrote:

> Here are two questions about the code below: > 1. Why the value for the variable name is the string "sun" instead of > "sunfish"? > 2. What's the purpose for listing the second x in the input statement? > > Thanks. Max > > data temp; > input x 1. name $varying9. x; > cards; > 3sunfish > ; > proc print; > run; > > Result of this code: > > obs x name > 1 3 sun

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