|
Hi Ben,
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
sig).
Regards - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
home.hccnet.nl/jim.groeneveld
On Wed, 5 Sep 2007 06:29:55 -0700, BJMurphy <murphy.ben@GMAIL.COM> wrote:
>Hi All,
>
>I have data that has an ID field, multiple category fields, and
>multiple measure fields in a normalized form, like this:
>
>id cat1 cat2 meas1 meas2
>1 a x 35 78
>1 b x 17 30
>1 a y 86 5
>1 b y 9 67
>2 a x 54 99
>2 b x 39 57
>2 a y 31 55
>2 b y 24 77
>
>At the end of processing, for use in downstream reporting and such,
>I'd like to denormalize it so that it looks like this:
>
>id a_x_meas1 a_y_meas1 b_x_meas1 b_y_meas1
a_x_meas2 a_y_meas2
>b_x_meas2 b_y_meas2
>1 35 86 17 9 78 5 30 67
>2 54 31 39 24 99 55 57 77
>
>
>In this example, I have two category fields (cat1,cat2) and two
>measures (meas1,meas2), and the names of the fields in the second
>table are representative of what I would like to do (namely using the
>values from the cat1 and cat2 variables in the first data to name the
>new fields).
>
>This seems like something PROC TRANSPOSE could help tackle, but
>everything I've tried turns out incorrectly. Any help or suggestions
>would be great.
>
>Thanks!
|