LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (March 2001, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 22 Mar 2001 11:33:34 -0500
Reply-To:     "Brucken, Nancy" <Nancy.Brucken@PFIZER.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Brucken, Nancy" <Nancy.Brucken@PFIZER.COM>
Subject:      Re: variable TYPE
Comments: To: 'Daniel a Andrén'
          <Daniela.Andren@ECONOMICS.GU.SE>
Content-Type: text/plain; charset="iso-8859-1"

Or in one pass through the dataset:

data a1 (rename=(genderN=gender)); set a1; genderN=input(gender,3.); drop gender; run;

Hope this helps, Nancy

Nancy Brucken Clinical/Regulatory Informatics Pfizer Global Research & Development, Ann Arbor (734) 622-5767 E-mail address: Nancy.Brucken@pfizer.com

-----Original Message----- From: Aldi Kraja [mailto:aldi@wubios.wustl.edu] Sent: Thursday, March 22, 2001 9:27 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: variable TYPE

Hi, If you want to convert the variables to numeric one way is to use the function input(NameOfVariable,informat.): example: gender is a defined character when read in the data (although read as 1 and 2 for M and F), but I want to be numeric variable: data a1; input gender $; /* <=== character */ datalines; 1 2 1 2 1 1 1 ; run; data a1 (drop= gender); set a1; genderN=input(gender,3.); run; data a1; set a1 (rename=(genderN=gender)); run;

Output: Obs gender /* <== numeric */

1 1 2 2 3 1 4 2 5 1 6 1 7 1

The same principle works from numeric to character, only now use the function put(). HTH, Aldi

Daniela Andrén wrote:

> Hi! > > I need to concatenate 25 files that contain the same variables, BUT they > have different TYPE (sometimes they are CHARACTER, sometimes they are > NUMERIC) and/or names. > > It seems that when the variables changed the names, they also changed the > type. If I REANME the variables, when I merge the files I got the message > that the same variable is both numerical and character... > > Any suggestion to change the type of variables before merging the files (or > any other solution) is very much appreciated. > > Regards, > Daniela

--


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