rockfido 发表于 2010-3-2 07:25
so in that case, all the first 1999 obs are not valid but only the last line is needed? because, I guess for n_, the 2000 obs should be valuing from 1, 2, 3, until 2000?
do u have any idea how could i add those p1_, p2_, p3_ as the last three observations under each variables (instead of being added as 3 new variables....)
According to my experience, before coding you’d better know what you need. Personally, I think, outputing to 3 additional lines is not good. Anyway, you can do like that:
i totally agree with you. actually either way works for my project. since i kept on thinking about adding 3 lines but without any idea, i'm just so curious about how to fulfill it. and ur rite, adding 3 lines actually doesnt make much sense, but just for some little advantage for my project.
BTW, I HAVE ANOTHER QUESTION, BY USING: "ARRAY TEST{1000}" IN THE DATA B STEP, WE DONT NEED TO USE: ARRAY TEST{1000} TEST1--TEST1000 FOR LOADING THE ARRAY?
BTW, I HAVE ANOTHER QUESTION, BY USING: "ARRAY TEST{1000}" IN THE DATA B STEP, WE DONT NEED TO USE: ARRAY TEST{1000} TEST1--TEST1000 FOR LOADING THE ARRAY?
Right. That is SAS default. When you did not specify the variable names, SAS will create or look for the variables of array name followed by numbers in order. For example
one more silly question......should it work? i tried (but probably with some problem?), and it seems that the portion will be replacing the last obs instead of appending after the last one....
one more silly question......should it work? i tried (but probably with some problem?), and it seems that the portion will be replacing the last obs instead of appending after the last one....
……
if Eof then do;
do i = 1 to 1000;
test{i} = p1_{i};
end;
output;
do i = 1 to 1000;
test{i} = p2_{i};
end;
output;
do i = 1 to 1000;
test{i} = p3_{i};
end;
output;
end;
run;
NOTE: There were 2000 observations read from the data set WORK.A.
NOTE: The data set WORK.B has 2003 observations and 8000 variables.
NOTE: DATA statement used (Total process time):
real time 2.57 seconds
cpu time 0.25 seconds
No, I should THANK YOU.....I guess Im just far away from being good at SAS programming...especially of dealing with the array there...I got the idea u used in ur program but I even cant debug the problem....TOO BAD.....but i will try harder!!