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 (December 1999, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 8 Dec 1999 08:52:06 -0800
Reply-To:     "Berryhill, Tim" <TWB2@PGE.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Berryhill, Tim" <TWB2@PGE.COM>
Subject:      Re: input function and informat w.d, w. bestw.
Comments: To: "Y.Huang@ORGANONINC.COM" <Y.Huang@ORGANONINC.COM>
Content-Type: text/plain

As I understand it, when SAS applies a w.d format to read a value, an explicit decimal in the raw data overrides the d value coded. Thus reading '168' through 8.3 uses the d value and is interpreted as 0.168, but reading '168.2' through the same 8.3 format uses the explicit decimal in the data resulting in the value 168.2.

This may not be good, but it is clear. As you mentioned in your post, the solution for your data is to omit the d portion of the informat.

> ---------- > From: Ya Huang[SMTP:Y.Huang@ORGANONINC.COM] > Reply To: Y.Huang@ORGANONINC.COM > Sent: Wednesday, December 08, 1999 8:42 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Q: input function and informat w.d, w. bestw. > > Hello all, > > 1 data _null_; > 2 a1='168'; > 3 a2='168.2'; > 4 b1=input(a1,8.); > 5 b2=input(a2,8.); > 6 c1=input(a1,8.3); > 7 c2=input(a2,8.3); > 8 d1=input(a1,best8.); > 9 d2=input(a2,best8.); > 10 put a1= b1= c1= d1=; > 11 put a2= b2= c2= d2=; > 12 run; > > A1=168 B1=168 C1=0.168 D1=168 > A2=168.2 B2=168.2 C2=168.2 D2=168.2 > > Above code shows that in converting a character var to a > numeric var using input function, the informat can not be > "w.d" if the original char var dose not have a decimal point, > I can use "w." or "bestw." in this case. I was expecting > c1=168.000, but as you can see, c1=0.168, totally wrong. > > Why is that? > > Thanks > > Ya Huang > Organon Inc. >


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