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 (March 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 17 Mar 2008 09:20:48 -0500
Reply-To:   Yu Zhang <zhangyu05@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Yu Zhang <zhangyu05@GMAIL.COM>
Subject:   Re: How to transfer all missing value all at once?
Comments:   To: Melodyp <pearsonmelody@gmail.com>
In-Reply-To:   <d4aba63d-80b3-4720-961d-da1bd8ed79a6@n75g2000hsh.googlegroups.com>
Content-Type:   text/plain; charset=ISO-8859-1

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 >


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