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 12:06:00 EST
Reply-To:   "30747::STRICKLA" <STRICKLA%30747.decnet@JS-JTF.AF.MIL>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   "30747::STRICKLA" <STRICKLA%30747.decnet@JS-JTF.AF.MIL>
Subject:   Using Macro Variables as Arrays
Comments:   To: sas-l <sas-l%marist.bitnet@uga.cc.uga.edu>

I N T E R O F F I C E M E M O R A N D U M

Date: 15-Feb-1996 12:10pm EST From: Christopher Alan Strickland STRICKLA Dept: MOT&E Tel No: (407) 726-7351

TO: _WINS% ( _DDN[sas-l%marist.bitnet@uga.cc.uga. edu] )

Subject: Using Macro Variables as Arrays

I'm creating a macro variable array as follows:

data _null_; set target end=eof; call symput("vehnum"||put(_n_,.1),vehid); if eof then do; call symput ("vehtot",put(_n_,1.)); end; run;

This works great, gives me results like:

vehnum1=11 vehnum2=18 vehnum3=23 vehnum4=57

My problem occurs when trying to access this macro variable array inside of a datastep.

Here's a synopsis of what I'm doing (symput doesn't work, %let always changes);

data x; array veh(&vehtot); retain veh1 - veh&vehtot x;

if first.val then do; do i=1 to &vehtot; veh{i}=0; end; link xeq1; (Also tryed symput, and %let, hoped link wouldn't resolve %let, until called)

end;

do until (&x >= &vehtot or out=1); if veh{&x}=gpsveh then do; out=1; link xeq1; end; else do; if &&vehnum&x=gpsveh then do; veh{&x}=gpsveh; out=1; link xeq1; end; %let x=%eval(&x + 1) end; end;

return;

xeq1: %let x=1; return;

Basically, I'm wanted to loop through and looke at vehnum1, vehnum2, vehnum3, and vehnum4.

Any ideas, hints, suggestions.

+------------------------------------------+ | Chris Strickland | | http://www.teg.saic.com/mote/people.html | | strickla@js-jtf.af.mil | +------------------------------------------+


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