[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: RE: RE: Another reshape wide question
I did read these pages before I got to this list, and they were very
helpful. Let me be more specific about my problem with an example:
Suppose that, for each individual and for each round, I have the
OpinionA OpinionB OpinionC. Now suppose I have many variables that
are individual-specific and do not differ among products: Gender,
Married, Nationality, etc.
What I'd like is to have the variable in form:
ID Opinion1A-Opinion3A Opinion1B-Opinion3B Opinion1C-Opinion3C Gender
So I need to do a reshape long on the opinion variables by product (A,
B, and C). I'd like to do this without generating GenderA-GenderC,
MarriedA-MarriedC and NationalityA-NationalityC variables as I have
many of these.
My data was originally in long form, so I did a renvars and reshape
wide (on the subvariable "round"), and the data is now of form
ID Opinion1A-Opinion3A [Opinion*B and Opinion*C blank] Gender1-3
ID [Opinion*A and Opinion*C blank] Opinion1B-Opinion3B Gender1-3
ID [Opinion*A and Opinion*B blank] Opinion1C-Opinion3C Gender1-3
I'd like to convert into the long form (by product) specified above.
Thanks very much,
On 4/18/06, Nick Cox <email@example.com> wrote:
> Also, check out:
> FAQ . . . . . . . . . . . . . . . . . . . . . . . Replacing missing values
> 2/03 How can I replace missing values with previous or
> following nonmissing values?
> Nick Cox
> > You've answered your own question. The answer is No,
> > in your circumstances.
> > Stata is not being awkward: it just doesn't see that
> > your proposed -reshape- make sense.
> > Amber Katz
> > > Thanks for all the responses to my previous question. One
> > other one:
> > > Will Stata let me "reshape" some variables wide and not others (the
> > > ones that are time invariant and hence missing in
> > observations 2 and 3
> > > for each individiual)? When I try to do this, it tells me
> > that those
> > > variables are not constant for each person.
> * 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/
* For searches and help try: