Date: Sat, 25 Oct 2008 16:12:22 -0400
Reply-To: kwu0914 <kwu0914@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: kwu0914 <kwu0914@GMAIL.COM>
Organization: Aioe.org NNTP Server
Subject: Re: Array Frustration!!!!
Try this,Jordan. Since the fyknot's are global macro variables, you can not
reference them the way that data step array is referenced. But you can use
a macro array in a macro definiton within a loop, then call macro in data
setp,
or you can reference them one by one in open code.
%macro data;
array X{5};
%do i=1 %to 5;
x{&i}=&&fyknot&i;
%end;
output;
%mend data;
data two;
%data
run;
"Lewis Jordan" <lewjord@UGA.EDU> wrote in message
news:20081025143110.OHN87412@punts3.cc.uga.edu...
>I am trying to pass an array of variables into another array. In the "data
>two" step, if I specify x{1}=&fyknot1, it works fine. However, this is
>inefficient and I don't want to have to write out each variable. What am I
>doing wrong in the "data two" do loop?
>
> Thanks in advance. -Lewis
>
> data one;
> array knots{5};
> do i=1 to 5;
> knots{i}=ranuni(38211);
> call symput (compress('fyknot'||i),trim(left(knots{i})));
> end;
> drop i;
> run;
>
> data two;set one;
> array x{5};
> do i=1 to 5;
> x{i}=&fyknot{i}; /*HELP ME HERE?????*/
> end;
> output;
> run;quit;
|