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 (May 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 13 May 2004 14:33:45 -0400
Reply-To:   "Chen, Jian" <ozz6@CDC.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Chen, Jian" <ozz6@CDC.GOV>
Subject:   Re: Scientific notation
Comments:   To: "Sinclair-James, Brian (OS)" <Brian.Sinclair-James@HHS.GOV>
Content-Type:   text/plain; charset="iso-8859-1"

Just read xx as numeric, it simply works, so why make so big efforts to read the notation?

data a; input xx ; cards; 120000 1.2E+6 0.3E+3 2.1e+4 ; proc print;run;

Obs xx

1 120000 2 1200000 3 300 4 21000

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Sinclair-James, Brian (OS) Sent: Thursday, May 13, 2004 1:41 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Scientific notation

You need to use the input function

data wbdata.pop4; set wbdata.pop3; s_1960=input(_1960,10.7); run;

-----Original Message----- From: CHRISTENSEN,KEVIN W [mailto:chriske2@UFL.EDU] Sent: Thursday, May 13, 2004 12:02 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Scientific notation

I tried this suggestion and best10. but I keep getting an error. Probably something wrong with my code:

I send:

data wbdata.pop4; set wbdata.pop3; informat _1960 e10.; run;

I get back:

62 data wbdata.pop4; 63 set wbdata.pop3; NOTE: SCL source line. 64 informat _1960 e10.; ---- 48 ERROR 48-59: The informat $E was not found or could not be loaded.

65 run;

It appears SAS is reading e10. format (and the best10. format) as if it should be a character format (given the $). I assume this is because in the original dataset the population figures are considered to be character. So now what?

On Thu May 13 11:48:54 EDT 2004, Harry Droogendyk <harry.droogendyk@RBC.COM> wrote:

> See Ew. informat, where w = width. > > -----Original Message----- > From: CHRISTENSEN,KEVIN W [mailto:chriske2@UFL.EDU] > Sent: Thursday, May 13, 2004 11:42 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Scientific notation > > > I have a SAS dataset that looks like the following: > > COUNTRY POPULATION > USA 1000000 > CHINA 1.0016E+07 > JAPAN 2.0616E+07 > TURKEY 2351522 > > The population variable is read in as a character and I'd like to read > it as a number. Unfortunately the scientific notation in some > observations will make it difficult (I think). Any ideas around this? > -- > CHRISTENSEN,KEVIN W > > ------------------------------------------------------------ > This e-mail may be privileged and/or confidential, and the sender does > not waive any related rights and obligations. Any distribution, use or > copying of this e-mail or the information it contains by other than an > intended recipient is unauthorized. If you received this e-mail in > error, please advise me (by return e-mail or otherwise) immediately. > > Ce courrier électronique est confidentiel et protégé. L'expéditeur ne > renonce pas aux droits et obligations qui s'y rapportent. Toute > diffusion, utilisation ou copie de ce message ou des renseignements > qu'il contient par une personne autre que le (les) destinataire(s) > désigné(s) est interdite. Si vous recevez ce courrier électronique par > erreur, veuillez m'en aviser immédiatement, par retour de courrier > électronique ou par un autre moyen. > > ============================================================ > >

-- CHRISTENSEN,KEVIN W


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