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 (October 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 24 Oct 2007 16:35:12 -0400
Reply-To:     "Clark, Mike (LRC)" <Mike.Clark@LRC.KY.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Clark, Mike (LRC)" <Mike.Clark@LRC.KY.GOV>
Subject:      Character to numeric Problem
In-Reply-To:  A<445d9dbe0710241322p27f10d81n10f80a1cc9e11eb8@mail.gmail.com>
Content-Type: text/plain; charset="us-ascii"

I received a question today that I couldn't answer. The following code converts several character variables to numeric. It works on variables recip through PBA but fails starting with POS1. We fixed this by changing the code some, but it still seems like this code should work. Does anyone know why this fails on some of the variables? The attributes for the character variables are $255.

data pharm1; set pharm1; if RECIP='DK' then RECIP=99; if PHARM='DK' then PHARM=99; if PT='DK' then PT=99; if MD='DK' then MD=99; if NP='DK' then NP=99; if OP='DK' then OP=99; if MOW='DK' then MOW=99; if LT='DK' then LT=99; if PM='DK' then PM=99; if PBA='DK' then PBA=99; if POS1='RDDNEA' then POS1=0; if POS1='RDDSI' then POS1=1; if POS1='RDDNEI' then POS1=2; if POS1='RDDSE' then POS1=3; if POS1='RDDVE' then POS1=4; if POS2='RCSNEA' then POS2=0; if POS2='RCSI' then POS2=1; if POS2='RCSNEI' then POS2=2; if POS2='RCSSE' then POS2=3; if POS2='RCSVE' then POS2=4; if POS3='ECSNEA' then POS3=0; if POS3='ECSSI' then POS3=1; if POS3='ECSNEI' then POS3=2; if POS3='ECSSE' then POS3=3; if POS3='ECSVE' then POS3=4; if POS4='FACSNEA' then POS4=0; if POS4='FACSSI' then POS4=1; if POS4='FACSNEI' then POS4=2; if POS4='FACSSE' then POS4=3; if POS4='FACSVE' then POS4=4; if PA1='RDDNEA' then PA1=0; if PA1='RDDSI' then PA1=1; if PA1='RDDNEI' then PA1=2; if PA1='RDDSE' then PA1=3; if PA1='RDDVE' then PA1=4; if PA2='RCSNEA' then PA2=0; if PA2='RCSSI' then PA2=1; if PA2='RCSNEI' then PA2=2; if PA2='RCSSE' then PA2=3; if PA2='RRCSVE' then PA2=4; if PA3='UBDNEA' then PA3=0; if PA3='UBDSI' then PA3=1; if PA3='UBDNEI' then PA3=2; if PA3='UBDSE' then PA3=3; if PA3='UBDVE' then PA3=4; RECIP_NUM=input (RECIP,1.); PHARM_NUM=input (PHARM,1.); PT_NUM=input (PT,1.); MD_NUM=input (MD,1.); NP_NUM=input (NP,1.); OP_NUM=input (OP,1.); MOW_NUM=input (MOW,1.); LT_NUM=input (LT,1.); PM_NUM=input (PM,1.); PBA_NUM=input (PBA,1.); POS1_NUM=input (POS1,1.); POS2_NUM=input (POS2,1.); POS3_NUM=input (POS3,1.); POS4_NUM=input (POS4,1.); PA1_NUM=input (PA1,1.); PA2_NUM=input (PA2,1.); PA3_NUM=input (PA3,1.); run;


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