[prev in list] [next in list] [prev in thread] [next in thread]
List: sas-l
Subject: Re: Data step Do loop to change the value of Macro Variable
From: xlr82sas <xlr82sas () AOL ! COM>
Date: 2010-02-28 0:25:09
Message-ID: 750c07cd-f96c-4f19-a606-7e607d49bcbb () k6g2000prg ! googlegroups ! com
[Download RAW message or body]
On Feb 26, 11:17 pm, kuh...@126.COM (Clark An) wrote:
> I think you are better of learning what the lag&i.(x) means...
> Data step Do loop to change the value of Macro Variable as the topic
> mentioned, I wanna instead the %do loop with data step do loop.
>
> Thank you.
Hi Clark An,
Do whatever you like with the N array. I am not sure you want. I used
I-1.
data mat2345;
retain n 0;
array x[2,3,4,5] x1-x120;
array nx[120] nx1-nx120;
/* do whatever you want here to define the n's */
/* I used i-1 but you can do something else */
do i=1 to 120;
n+1;
nx[i]=i-1;
end;
n=1;
do i=1 to 2;
do j=1 to 3;
do k=1 to 4;
do l=1 to 5;
x[i,j,k,l]=nx[n];
n+1;
end;
end;
end;
end;
output;
run;
Here is what the output looks like
X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic