|
Hi, Melodyp,
you need to do something like this to convert missing to -1,
data melody.combine_final_5;
set melody.combine_final_4;
array num {*} _numeric_;
array char {*} _character_;
do i=1 to dim(num);
if missing(num{i}) then miss=num{i}=-1;
end;
do i=1 to dim(char);
if missing(char{i}) then miss='-1';
end;
run;
On Sun, Mar 16, 2008 at 10:21 PM, Melodyp <pearsonmelody@gmail.com> wrote:
> On Mar 15, 12:27 am, Patrick <patrick.mat...@gmx.ch> wrote:
> > On Mar 15, 2:48 pm, Melodyp <pearsonmel...@gmail.com> wrote:
> >
> > > I have a data set with many missing value both in "." or " ", how can
> > > I transfer them all at once?
> >
> > > I used the code below but return 0 observations in the new dataset.
> >
> > > Thank you in advance for your help.
> >
> > > Melody
> >
> > Missed your "code below" so I had to guess.
> > Are you're looking for something like the code below?
> >
> > data have;
> > a='a';b=1;c=1;output;
> > a='';b=1;c=1;output;
> > a='';b=.;c=1;output;
> > a='a';b=.;c=.;output;
> > run;
> >
> > data NoMissings Missings;
> > set have;
> > array num {*} _numeric_;
> > array char {*} _character_;
> >
> > do i=1 to dim(num);
> > if missing(num{i}) then miss=1;
> > if miss=1 then leave;
> > end;
> > do i=1 to dim(char);
> > if miss=1 then leave;
> > if missing(char{i}) then miss=1;
> > end;
> >
> > drop i miss;
> > if miss then output Missings;
> > else output NoMissings;
> > run;
>
> Patric,
>
> Thank you very much for your reply, I forget to attach my code, here
> is the code I used but I don't know where I did wrong, as it's not
> working.
> data melody.combine_final_5;
> set melody.combine_final_4;
> if missing(_num_) then _num_=-1;
> if missing(_character_) then _character_= -1;
> run;
>
> Thank you again.
>
> Melody
>
|