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 (April 2012, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sun, 15 Apr 2012 10:19:27 -0400
Reply-To:   Nat Wooding <nathani@VERIZON.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Nat Wooding <nathani@VERIZON.NET>
Subject:   Re: How to change many missing variables to 0 in a single data step
In-Reply-To:   <201204151402.q3F4FiSd009857@waikiki.cc.uga.edu>
Content-Type:   text/plain; charset="US-ASCII"

Randy

As Tom just pointed out, you want to do this using an array. Rather than specify the individual variables like varA1-varA50 , you could use

Array myarray _numeric_ ;

Which refers to all numeric variables in the data set.

Now, do you really need to change the values to zero or is this simply for the purpose of seeing zeros in printed output. If it is purely for appearance sake, you could specify

Options missing = 0;

And zeros will print in place of periods.

Nat Wooding

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Randy Sent: Sunday, April 15, 2012 10:03 AM To: SAS-L@LISTSERV.UGA.EDU Subject: How to change many missing variables to 0 in a single data step

I have many variables and some of the values are missing. I want to change the missing values to 0 in a single data step.

The code I have written is: Data want ; set have; if VarA1 - VarA50 = . then VarA1 - VarA50 = 0 ; run;

I am getting an error term. What is the mistake that I am making?

Randy


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