Date: Thu, 17 Aug 2006 14:32:24 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: Missing values to zeros
On Thu, 17 Aug 2006 13:03:16 -0500, data _null_; <datanull@GMAIL.COM> wrote:
>No if then else.
>
>data work.zeros;
> do id = 1 to 10;
> output;
> end;
> retain x y z 0;
> run;
>data work.missing;
> infile cards missover;
> input id x y z;
> cards;
> 1 . 4 5
> 2 . 4 5
> 3 3 . 1
> 4 . . .
> 5 . 4 5
> 6 9 8 8
> 7 . 3 1
> 8
> 9
>10
>;;;;
> run;
>data work.updatedWithZeros;
> update work.zeros work.missing;
> by id;
> run;
>proc print;
> run;
The catch is that the step which builds WORK.ZEROES requires hard-coding the
names of the variables and the number of observations.
Here's a way to derive it without those specifics:
data zeroes;
if 0 then set missing;
retain _numeric_ 0;
set missing(keep = id);
run;
>
>
>On 8/17/06, sasguy <addanki007@gmail.com> wrote:
>> How can we covert missing values to zeros of around hundred variables
>> without using
>> if-then-else
>> is there any efficient way we can write?
>> Thanks in advance
>>