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 (February 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 27 Feb 2007 16:11:13 -0600
Reply-To:     Robin High <robinh@UNLSERVE.UNL.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Robin High <robinh@UNLSERVE.UNL.EDU>
Subject:      Re: RECODE MISSING
Comments: To: Ran S <raan67@YAHOO.COM>
In-Reply-To:  <200702272000.l1RGGN0x023948@mailgw.cc.uga.edu>
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Tue, 27 Feb 2007, Ran S wrote:

> Hi, > > I am using an array to recode universally all the variables with missing > values (.) to 90. How can I just recode only those variables starting with > prefix X_? >

No compelling reason was given why you want to recode missing values of x_ to 90 and is almost never a good idea to do so; it is much safer to code these missing values you want to be represented as '90' to one of the other SAS missing data values, such as .z -- and then, if for some reason you absolutely must see missing data as 90, you can assign .z to be 90 (or some other code) with a FORMAT , e.g. something like:

proc format; value ms .z='90'; run;

* can apply logic already given to identify all variables that begin with x_ ;

DATA xyz; do i=1 to 10; x_ = 88+ CEIL(4*(RANUNI(929))); IF x_ eq 90 then x_= .z; OUTPUT; END;

PROC freq; TABLE x_ FORMAT x_: ms. ; RUN;

The FREQ Procedure

Cumulative Cumulative x_ Frequency Percent Frequency Percent ------------------------------------------------------- 89 2 33.33 2 33.33 92 4 66.67 6 100.00

Frequency Missing = 4 <--- 4 missing data values still there

.. and here they are coded as .z and represented as '90'

PROC PRINT NOobs; FORMAT x_: ms. ; RUN;

i x_

1 92 2 89 3 90 4 92 5 89 6 90 7 90 8 92 9 90 10 92

Robin High


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