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 (June 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 12 Jun 2003 10:47:13 -0700
Reply-To:     "Huang, Ya" <yhuang@AMYLIN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Huang, Ya" <yhuang@AMYLIN.COM>
Subject:      Re: Replacing certain values with unique dummies
Comments: To: Jeff Morison <jmt_mtf@YAHOO.COM>
Content-Type: text/plain; charset="iso-8859-1"

data xx; input old_var; cards; 123456789 234567891 0 0 9 403815720 256188877 . . 0 0 9 . 9 ;

data xx (drop=n); set xx; if _n_=1 then n=0; if old_var not in (0,9,.) then new_var=put(old_var,9.); else do; n+1; new_var='A'||put(n,z8.); end;

proc print; run; --------- old_var new_var

123456789 123456789 234567891 234567891 0 A00000001 0 A00000002 9 A00000003 403815720 403815720 256188877 256188877 . A00000004 . A00000005 0 A00000006 0 A00000007 9 A00000008 . A00000009 9 A00000010

HTH

Ya Huang

-----Original Message----- From: Jeff Morison [mailto:jmt_mtf@YAHOO.COM] Sent: Thursday, June 12, 2003 10:25 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Replacing certain values with unique dummies

I have a variable with 9 digit values, some of which could be just 9s, zeros or missing, I need to replace them with an unique dummy as follows, appreciate any thoughts.

old_var new_var 123456789 123456789 234567891 234567891 0 A00000001 0 A00000002 9 A00000003 403815720 403815720 256188877 256188877 . A00000004 . A00000005 0 A00000006 0 A00000007 9 A00000008 . A00000009 9 A00000010

TIA, Jeff

__________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com


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