Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: 'Transposing' data- follow up question


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: 'Transposing' data- follow up question
Date   Wed, 1 Dec 2004 11:49:22 -0500

If the data are in order by region within company, then you can just generate the region variable as:

bysort company: gen int region=_n

But if there are missing regions in the middle of the data for a company, then Stata would need ESP to determine which observations correspond to which regions. I don't think ESP will be available until Stata 11 :)

Michael Blasnik
[email protected]

----- Original Message ----- From: "Shyam Kumar" <[email protected]>
To: <[email protected]>
Sent: Wednesday, December 01, 2004 11:35 AM
Subject: st: 'Transposing' data- follow up question



Many thanks to all of you who responded yesterday. The
reshape wide command seems the most applicable. I do
have an additional question though. My data set does
not contain a separate variable that I can specify
under j. Further, the number of observations (under
the j variable, if there was one) also vary. In other
words my data set is as follows:

Company identifier     Sales by region
X                      25
X                      40
Y                      125
Y                      100
Y                      65

I do not have a variable, region that is coded with
values 1,2,3. Also in the above example X's sales in
region 3 are 0, but there is no separate row for X for
region 3 with a value 0. Any insights on how I can
overcome these problems would be much appreciated.

Thank you once again.

Shyam

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index