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 15:07:52 -0400
Reply-To:   john.hixon@KODAK.COM
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   john.hixon@KODAK.COM
Subject:   Replacing certain values with unique dummies
Comments:   To: jmt_mtf@YAHOO.COM
Content-type:   text/plain; charset=us-ascii

/* Jeff asked:

Date: Thu, 12 Jun 2003 10:24:50 -0700 From: Jeff Morison <jmt_mtf@YAHOO.COM> 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.

I'm on digest so this has probably been answered many times over, but...here you go: */

data junk; input old_var$ Desired_new_var$; new_var=Old_var; if missing(old_var) or old_var in (0 9) then do; n++1; new_var="A"||put(n,z7.); end; datalines; 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 ; run; proc print data=junk; run;

/* HTH?

Best regards,

John Hixon Eastman Kodak Company Rochester, NY USA 585-477-1984


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