Date: Wed, 3 Jun 2009 03:10:00 -0700
Reply-To: RolandRB <rolandberry@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: RolandRB <rolandberry@HOTMAIL.COM>
Organization: http://groups.google.com
Subject: Re: How to check for a binary number?
Content-Type: text/plain; charset=ISO-8859-1
On 3 Jun., 11:28, Amar Mundankar <amarmundan...@gmail.com> wrote:
> Hi all,
> I want the user should pass only a binary value (e.g, 11001, 100011)
> to a macro function. How can we check that whether the value passed is
> in Binary format or not?
>
> e.g.
> %macro IsBin(val);
> /*
> some sas code here to check whether the &val is binary or not.
> */
> %mend IsBin;
>
> Regards,
> Amar Mundankar.
%macro IsBin(val);
%if %quote(%sysfunc(compress(&val,01))) NE %then %put >>>> Not binary
>>>;
%else %put >>> Is binary >>>>;
%mend IsBin;
%IsBin(1001);
|