Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Reshaping but not numeric and more a loop needed!


From   Miyu Lee <[email protected]>
To   [email protected]
Subject   st: Reshaping but not numeric and more a loop needed!
Date   Sun, 30 Oct 2011 01:29:38 +0200

Hello

I want to reshape the following table

A           B
1.11    1.11
1.11    1.12
1.11    1.13
1.11    1.14
1.11    1.15
1.11    1.16
1.11    1.19
1.11    1.26
1.11    1.28
1.11    1.29
1.11    1.63
1.11    1.64
1.20    1.11
1.20    1.12
1.20    1.20
1.20    1.20
1.21    1.13
1.21    1.14
1.21    1.21
1.21    1.22
1.21    1.23
etc     etc

to look like this:

A          B1       B2     B3
1.11    1.11     1.12    1.13 etc
1.20    1.11     1.12    1.20 etc
1.21    1.14 etc.

!!! my ideal would be if STATA just puts the B value next to the B
value of the first observation within each group, as long as the A
values are the same.!!!

reshape does not work here because it creates a huge matrix where all
identical B values are stacked on top of each other and/or there might
also be a problem that the size of the group is not equal.

any suggestions would be helpful. the matrix is very long so a loop or
anything similar seems the only alternative.

Many thanks

Miyu
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index