Date: Mon, 4 May 2009 14:32:02 -0500
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: Weird Character String
In-Reply-To: <16FD64291482A34F995D2AF14A5C932C07437D0A@MAIL002.prod.ds.russell.com>
Content-Type: text/plain; charset=ISO-8859-1
I'll add to that, what do you think "missing" means? I wonder if you are
using
if missing(x)
when x="."
which will fail:
data test;
x=".";
if missing(x) then y="MISSING! ";
else y="NOT MISSING";
run;
proc print; run;
-Joe
On Mon, May 4, 2009 at 2:13 PM, Terjeson, Mark <Mterjeson@russell.com>wrote:
> Hi Mona,
>
> There are two things to check at the 30,000foot level.
> 1) is your IF expression really checking what you
> think it is checking?
> 2) and/or it would be helpful to find out the exact content.
>
> If it really is number two above that the content is
> really weird, it would be advantages to find out exactly
> what it is so that we then know how to approach dealing
> with it. The following little program, or your favorite
> editor with hex display capability, etc., can be used to
> look and see what the actually ASCII (or EBCDIC) values
> are so that we can then determine how to address it.
>
> Also, we should know where in your code the problem is
> taking place, if it is during INPUTing in a file, there
> are options for INPUT and INFILE to assist. If the data
> is already in a SAS dataset then you are just need to
> check or alter with string handling functions. Or ....
>
>
> The program below is a sample to visually see what
> the contents of a string are:
>
>
> * create sample data ;
> * you would use your own dataset ;
> * you would use your own varname ;
> data mydata;
> myvar = 'Hello'||byte(7)||' World'||byte(244);
> run;
>
> proc format;
> value range
> 0-31 = '[control character]'
> 32-126='[printable character]'
> 127-255='[graphical or other]'
> ;
> run;
>
> data _null_;
> length c $1 s $100;
> set mydata;
> theLength = length(myvar);
> do position = 1 to theLength;
> c = substr(myvar,position,1);
> s = 'Position '||put(position,3.)
> ||' Rank is '||put(rank(c),3.)
> ||' (hex:'||put(rank(c),hex2.)
> ||') '||put(rank(c),range.);
> put s=;
> end;
> run;
>
>
>
>
> Hope this is helpful.
>
>
> Mark Terjeson
> Investment Business Intelligence
> Investment Management & Research
> Russell Investments
> 253-439-2367
>
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Mona
> Sent: Monday, May 04, 2009 11:49 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Weird Character String
>
> Hi All,
>
> I have a dataset where this one variable has a missing value for a lot
> of
> observations. The problem I having is when I use the missing function or
> just a plain if to filter out records with missing value of that
> variable,
> nothing gets filtered. I do see a lot of them with missing values but
> somehow it is not picking. Is there any function to resolve this ?
>
> Any help appreciated.
>
|