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 (November 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 9 Nov 2007 11:49:47 -0500
Reply-To:     John Keane <john.keane@WATSONWYATT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         John Keane <john.keane@WATSONWYATT.COM>
Subject:      Looping Macro Vairables

I have a large number of macro variables defined from a dataset as follows:

call symput(cats("SALARY_ORG_", VARA, "_", VARB, "_", VARC), SALARY_ORG);

In the end, this macro variable will exist for each combination of VARA, VARB, VARC in the dataset, more than 1000 times.

I have a dataset that contains field holders for each iteration of this variable. I need to process the following statement for every iteration of the macro variables defined above.

In the simple example below, VARA= 0010, VARB = 0 and VARC = 1. The values of VARA, VARB, VARC come from a dataset (WORK.VARS)

DATA WORK.XML_ALL; SET WORK.XML_ALL; if find(upcase(VAR1),"SALARY_ORG_0010_0_1", 1) ge 1 THEN VAR1=TRANWRD (VAR1, "~SALARY_ORG_0010_0_1", "&SALARY_ORG_0010_0_1"); if find(upcase(VAR1),"SALARY_ORG_0010_0_2", 1) ge 1 THEN VAR1=TRANWRD (VAR1, "~SALARY_ORG_0010_0_2", "&SALARY_ORG_0010_0_2"); RUN;

How can I do this without having to type in the command for every iteration of VARA, VARB, VARC?

John Keane


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