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 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 13 May 2003 12:21:25 +0200
Reply-To:     Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Subject:      Re: convert char values to nums
Comments: To: Roland <roland@RASHLEIGH-BERRY.FSNET.CO.UK>
Comments: cc: Ray Wallace <raymondw@UIDAHO.EDU>
Content-Type: text/plain; charset="iso-8859-1"

Hi Ray,

Only 5 days ago this issue was discussed on this list. Did you miss that? I wrote:

"I have sent my macro ArecodeN, which also takes care to keep as many attributes as applicable, to Paul. Not too long ago I have presented the macro on this list as well."

Anyway, you can't change the type of a variable; it is either a numerical variable or a text variable. My macro makes it (more of them actually) a new, numerical one and later renames it to the original name(s).

If you want my macro (as a starting point) then drop me a line.

Regards - Jim. -- Y. (Jim) Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070 senior statist./data man. P.O. Box 1 fax. +31 412 407 080 J.Groeneveld@ITGroups.com 5350 AA BERGHEM, NL www.imrotramarko.com

My computer is out of inspiration at the moment, and my inspiration comes out of my computer.

Notice of confidentiality: this e-mail may contain confidential information intended for the addressed recipient only. If you have received this e-mail in error please delete this e-mail and please notify the sender so that proper delivery can be arranged.

> -----Original Message----- > From: Roland [mailto:roland@RASHLEIGH-BERRY.FSNET.CO.UK] > Sent: 12 May 2003 22:06 > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: convert char values to nums > > > I feel another macro coming on. Just need a little more "inspiration". > > > > "Ray Wallace" <raymondw@uidaho.edu> wrote in message > news:b9os8n$706$1@kestrel.csrv.uidaho.edu... > > I am getting variables from a datasource such as ACT score > and gpa. When > SAS > > queries these fields, proc contents shows that they are > Chars. I need them > > to be numeric values. > > > > How can a change char values in a field to their > corresponding numeric > > values. For example, an if statement for each values would > do it, but > there > > are a lot of different values. I.e., there would be too > many of these > types > > of statements: if gpa eq '3.42' then gpa = 3.42; > > > > thanks, > > > > >


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