Date: Mon, 18 Nov 2002 11:13:41 -0500
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: Is a variable Numeric?
On Mon, 18 Nov 2002 10:53:03 +0200, =?windows-1255?B?4uPpIOHvICDg4ek=?=
<GADI_B@MALAM.COM> wrote:
>Hi all,
>
>How do I check if a variable is numeric?
>
>How do I check if a text variable has numeric content (only digits, a
period and a sign)?
>
>TIA
>
>Gadi
The verify function can help you a bit. But it is not the whole answer:
-123 is ok, but what about 123- or 1-23
12e3 is also numeric, or 12e-2, but 12-e3? What about 12d2? It is numeric!
(I think that comes from FORTRAN, where a "d" was for "double precision".
A simple way is: convert it to numeric with INPUT and compare it with .
(=missing)
|