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 (February 1996, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 15 Feb 1996 11:09:01 PST
Reply-To:     TWB2%Rates%FAR@GO50.COMP.PGE.COM
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         TWB2%Rates%FAR@GO50.COMP.PGE.COM
Subject:      Re: Using Macro Variables as Arrays

Chris, I will avoid the temptation to ask, "Why not just merge work.target with the (I hope it just got typo'd) dataset SET into the second datastep."

If I had macro variables &vehnum1-&&vehnum&vehtot and I wanted to use them in an array in a datastep, I would do something like:

DATA NOMERGE; ARRAY _VEHNUM (&vehtot) VEHNUM1-VEHNUM&vehtot; %do ptr=1 to &vehtot; _VEHNUM(&ptr)=&&vehnum&ptr; %end; ...other code... RUN;

The ARRAY statement defines datastep variables using the same names as the macro variables, and the %do loop assigns each macro variable to the datastep variable with the same name. You could also replace the %do with a plain do, and use CALL SYMGET. You might want to RETAIN the variables in the array.

Tim Berryhill - Contract Programmer and General Wizard TWB2@PGE.COM Frequently at Pacific Gas & Electric Co., San Francisco The correlation coefficient between their views and my postings is slightly less than 0


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