| Date: | Mon, 7 May 2012 09:41:25 -0400 |
| Reply-To: | Subhadra Srigiriraju <subhadrasri@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Subhadra Srigiriraju <subhadrasri@GMAIL.COM> |
| Subject: | Re: Setting missing values to 0 of many variables. |
|
| In-Reply-To: | <201205071057.q474gTFm018098@waikiki.cc.uga.edu> |
| Content-Type: | text/plain; charset=ISO-8859-1 |
|---|
You can also use array in data step:
*data* want;
set have;
array miss(*) _numeric_;
do i = *1* to dim(miss);
if miss(i)=*.* then miss(i)=*0*;
end;
drop i;
*run*;
On Mon, May 7, 2012 at 6:57 AM, Randy <randistan69@hotmail.com> wrote:
> I have many variables that have missing value that I want to set to zero.
> Is it possible to do it in a shorter way
>
> I wrote:
>
> data want ; set have ;
> if VarA = 2 and VarB = . then VarB = 0 ;
> if VarA = 3 and VarB = . then VarB = 0;
> /* and so on*/
> run;
>
> VarA goes from 2-50 and I have 10 other Vars. Unfortunately they are not
> numbered.
> Randy
>
|