| Date: | Thu, 23 Mar 2006 14:07:32 -0500 |
| Reply-To: | Kevin Roland Viel <kviel@EMORY.EDU> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Kevin Roland Viel <kviel@EMORY.EDU> |
| Subject: | Re: Macro Question |
| In-Reply-To: | <200603231851.k2NHBfE5019534@mailgw.cc.uga.edu> |
| Content-Type: | TEXT/PLAIN; charset=US-ASCII |
|---|
On Thu, 23 Mar 2006, Rathindronath wrote:
> I have a statement as follows:
>
> set pilot_labrslt(where=((newvisit ='V01' )or (newvisit ='V02' ) or
> (newvisit ='V03' ) or (newvisit ='V04' ) or
> (newvisit ='V05' ) or (newvisit ='V06' ) or
> (newvisit ='V07' ) or (newvisit ='V08' ) or
> (newvisit ='V09' ) or (newvisit ='V10' ) or
> (newvisit ='V11' ) or (newvisit ='V12' ) or
> (newvisit ='V13' ) or (newvisit ='V14' ) or
> (newvisit ='V15' ) or (newvisit ='V16' ) or
> (newvisit ='V17' )) in =b)
>
>
> How can I write a macro for the above statement so I do not have to
> type (newvisit ='V0?' ) where Newvisit (character variable) has
> hounderds of visit number ( like V01...V02..V03..................)?
> THANKS a lot in advance for your help.
No macro needed for the above:
set pilot_labrslt ( where = ( 1 <= input( substr( newvisit , 2 , 2 ) , 8.
) <= 17 )
I prefer the INPUT() function over
where = ( "V01" <= newvisit <= "V17" )
since I know exactly what is between 1-17 but its downfall is if things
other than numbers appear: V1A. In which case, the INPUT() function will
cry foul...
There will be many, many other ways to achieve the above request without
macro.
Good luck,
Kevin
Kevin Viel
Department of Epidemiology
Rollins School of Public Health
Emory University
Atlanta, GA 30322
|