Date: Tue, 26 Aug 2008 18:21:30 -0400
Reply-To: Toby Dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Toby Dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Help with multi tier if then statement (or best option)
Data Need ( Drop = I ) ;
Set Have ;
Array FLG ( * ) FLG: ;
Do I = 1 To Dim( FLG ) ;
If Not Missing( FLG ) Then
CombFlg = CatX( '_' , CombFlg , VName( FLG( I ) ) ) ;
End ;
Run ;
On Tue, 26 Aug 2008 17:53:00 -0400, Norman Weston <nweston@AMGEN.COM>
wrote:
>I am putting together a simple Datastep and am having a problem. I have
>four flags within each data row, any one of which can either have a value
>or be blank. the intent is, based on conditional logic (or best method
>suggested) is to generate a fifth value that is an amalgum of all the
>previous four. Example to follow.
>
>Fields are
>
>FLG1
>FLG2
>FLG3
>FLG4
>
>The values in the fields match the field name. Where there is a value in
>the fields FLG1, FLG3 and FLG4, the end result based on the output is as
>follows
>
>FLG1_FLG3_FLG4
>
>If there were only data in FLG2, the outcome value would be
>
>FLG2
>
>You get the point. But literally there could be any combination of values
>from any of the four fields.
>
>Anyway, I can set up conditional logic (a flip diagram) that covers all
>possible combinations but would prefer something more dynamic and less
>cumbersome than 20-30 lines of if_then code.
>
>I tried using a simple concat, but I have to hard code in the "_" and this
>invariably leaves me with leading and following "_" which I want to avoid.
>
>Any help would be greatly appreciated.
|