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 (September 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 10 Sep 2003 04:52:45 -0400
Reply-To:   Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject:   Re: any ideas...

I can't believe that you are using that code really! Id like to see your log for that. I think, some semicolons would help there. Maybe something like that:

data x ; set x ; if variable lt 0 then delete; run;

but in comparing chars with numerics, sometimes unexpected results may occure.

On Wed, 10 Sep 2003 08:54:49 +0200, Groeneveld, Jim <jim.groeneveld@VITATRON.COM> wrote:

>Hi Jim, > >You have a character variable Variable, so in principle you may not use expressions and conditions where its numerical value is needed. However, SAS in such cases performs implicit type conversion (in memory) in order to process the statement. But as you have text as values from the variable ('#n/a') that can not be converted appropriately and thus will not succeed. You'll have to base your condition(s) upon the literal text(s), occurring as a representation of missing values, thus '#n/a' or maybe '#N/A' or even 'n/a' and the like as well if those values also occur. For SAS that is just literal text without any known meaning. If you do not yet succeed in deleting all records with what you defined as missing values for that Variable then call again and provide some code and some sample data as well. > >Regards - Jim. > >Y. (Jim) Groeneveld MSc >Biostatistician >Vitatron B.V. >Meander 1051 >6825 MJ Arnhem >The Netherlands >+31/0 26 376 7365; fax 7305 >Jim.Groeneveld@Vitatron.com >www.vitatron.com > > >-----Original Message----- >From: tin-shun-jimmy chan [mailto:jimmy.chan@HEC.CA] >Sent: Wednesday, September 10, 2003 01:02 >To: SAS-L@LISTSERV.UGA.EDU >Subject: any ideas... > > >Hi, > >I want to delete some observations with #n/a from observations with >numeric data (but in character format). I have succeeded to delete part >of the #n/a observations with > >data x >set x >if variable = '#n/a' then delete; >run; > >but not all #n/a. So I use the following codes: > >data x >set x >if variable lt 0 then delete; >run; > >and it doesn't work. In opposite, I use the 'where' function at the >menu bar with the instruction 'variable lt 0' to find the #n/a >observations and SAS did find it for me. So could you tell me why i >couldn't delete it with my codes. Hope that you understand my question. > >Thank you. > > >Jim


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