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 1996, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 20 Aug 1996 14:36:37 -0500
Reply-To:     /G=Robert/S=Agostinelli/O=astra_usa_inc/OU1=ASTRA1@MHS-ASTRAUSA.ATTMAIL.COM
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Robert Agostinelli
              </G=Robert/S=Agostinelli/O=astra_usa_inc/OU1=ASTRA1@MHS-ASTRAUSA.ATTMAIL.COM>
Subject:      Using a variable's values to create SAS source code

Hi folks,

I have a SAS dataset ( with 1000's of observations ) that has 4 variables:

Patient Age Sex Condition ------- --- --- ------------------------------------------

1 21 M If age > 12 and age < 26 2 63 F If age < 18 3 45 M If age > 18 and sex = M . . . etc.

The condition variable is different for each observation. I have already written the SAS code that parses the condition into three variables: a low age range, a high age range, and the sex condition. In reality, the condition also contains criteria for race and other parameters as well.

However, I am looking for a cleaner solution than having to parse the text. I would like to be able to use the value of the condition variable as part of the SAS program that evaluates the observation as pass/fail. To do this, I know that macros are required to build dynamic SAS code.

Therefore, I want to create a 5th variable that flags whether or not the current obs. meets it's own condition.

For example, patient 1 would pass it's own condition, and the flag would be set to 'pass'. Patient 2 would fail since the patient is 63 years old and the condition to pass requires them to be less than 18. Patient 3 would pass.

Does anyone know what the SAS macro code should be to perform this task?

Thanks for your help.


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