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 (February 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 13 Feb 2008 17:24:51 -0500
Reply-To:   "data _null_," <datanull@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "data _null_," <datanull@GMAIL.COM>
Subject:   Re: question about input()
Comments:   To: Mindy <master2005_sas@yahoo.com>
In-Reply-To:   <e5d433b5-6cdc-476b-859d-5ea4c77b826a@l16g2000hsh.googlegroups.com>
Content-Type:   text/plain; charset=WINDOWS-1252

Numeric values are converted to character using BEST12. So when you read the value of A that is converted to character the first 3 columns are blank and you just read blanks. You probably want PUT function but that is unclear. The following tries to illustrate the effect of the conversion to character with variable CC.

data try; input a; cards; 1 ; run; data try; set try; length cc $12; cc = a; cc = translate(cc,'!',' '); *to see the spaces; c=input(a,3.1); *reads first 3 columns of converted numeric; d=put(a,3.1); run; proc contents; run; proc print; run;

On Feb 13, 2008 5:07 PM, Mindy <master2005_sas@yahoo.com> wrote: > Hey guys, > > I have a question about input() ___ maybe related with format/ > informat. > > Below is sample code: > > data try; > input a; > cards; > 1 > ; > run; > data try; > set try; > c=input(a, 3.1); > run; > proc contents; run; > proc print; run; > > And I got note as > > 20 set try; > 21 c=input(a, 3.1); > 22 run; > > NOTE: Numeric values have been converted to character values at the > places given by: (Line):(Column). > 21:12 > > Output of proc contents as > > --Alphabetic List of Variables and Attributes----- > > # Variable Type > Len Pos > > ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ > 1 a Num > 8 0 > 2 c Num > 8 8 > > Output of proc print as > > Obs a c > > 1 1 . > > > I don't understand why I get the note and missing value of c, which I > thought it should be 1.0 > > Many thanks. > > MIndy >


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