| Date: | Mon, 18 Nov 2002 08:29:42 -0800 |
| Reply-To: | shiling zhang <shiling99@YAHOO.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | shiling zhang <shiling99@YAHOO.COM> |
| Organization: | http://groups.google.com/ |
| Subject: | Re: Is a variable Numeric? |
| Content-Type: | text/plain; charset=ISO-8859-1 |
I think it may be better to use SAS input function to test for
convertible strings. There are many forms of number representations in
SAS.
data _null_ badguys;
x='123.56+';
y=input(x, ? best.);
if _error_=1 then output badguys;
run;
"roland.rashleigh-berry" <roland.rashleigh-berry@ntlworld.com> wrote in message news:<Gl2C9.115$p_2.44298@newsfep1-win.server.ntli.net>...
> "גדי בן אבי" <GADI_B@MALAM.COM> wrote in message
> news:B3A415965C0CBC46AE5D76C9B90166AD215C96@jer-mailbox1.jer.ad.malam.com...
> Hi all,
>
> Q: How do I check if a variable is numeric?
>
> A: You can use the "vartype()" function.
>
> Q: How do I check if a text variable has numeric content (only digits, a
> period and a sign)?
>
> A: if compress(var,'0123456789.+-') EQ ' ' then...
|