LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 26 Aug 2008 17:53:00 -0400
Reply-To:     Norman Weston <nweston@AMGEN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Norman Weston <nweston@AMGEN.COM>
Subject:      Help with multi tier if then statement (or best option)

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.


Back to: Top of message | Previous page | Main SAS-L page