I have brought it to the attention of SAS-L so many times in the past, that
I don't want to fully elaborate on it now. Besides David C. does not so much
agree with it and usually proposes alternatives depending on the purpose.
But my macro MR2RM just does that transposition at once (folding, hinging).
I use it to process relations between the various repeated variables within
records (e.g. differences). Search for the postings on MR2RM in the SAS-L
archives (and find the location where to download the macro and some
auxiliary ones as well) or see the SAS macro directory on my website (in my
However, what you want exactly is not possible. Dimensions can not be
different within a data step. But then the superfluous variables (array
elements) will just be missing.
Regards - Jim.
Jim Groeneveld, Netherlands
Statistician, SAS consultant
On Tue, 4 Sep 2007 21:01:32 -0400, SUBSCRIBE SAS-L Anonymous
> My data is structured in the following manner:
>Obs VarA VarB VarC
>1 A 10.2 14.3
>2 A 10.4 15.7
>3 A 10.25 13.6
>4 A 9.1 10.2
>5 B 2.4 3.6
>6 B 1.2 3.4
>7 C 10.2 9.2
>8 C 9.4 4.5
>9 C 4.5 8.6
>The next step is for me to construct an array
>data need ; set original ;
>array M (*) VarD1-VarD?? _Character_;
>array N (*) VarE1-VarE??;
>and so on.
>the Array numbers depends on the observations for each VarA. So when VarA
>array M (*) VarD1-VarD4 _Character_ ;
>array N (*) VarE1-VarE4;
>and when VarA = B
>array M (*) VarD1-VarD2 _Character_ ;
>array N (*) VarE1-VarE2; and so on
>Any suggestions as to how to substitute the number of observations for
>each VarA into the arrays? This is a big data set and there are about 2000
>different values for VarA.