Statalist


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

Re: st: wide to long form


From   Shehzad Ali <[email protected]>
To   [email protected]
Subject   Re: st: wide to long form
Date   Sat, 5 Dec 2009 16:42:01 -0800 (PST)

Thank you very much to all, esp. Austin. This was spot on. Saved me hours!

Many thanks,
Shehzad



----- Original Message ----
> From: Austin Nichols <[email protected]>
> To: [email protected]
> Sent: Sat, December 5, 2009 4:55:11 PM
> Subject: Re: st: wide to long form
> 
> Just a bit of detail:
> 
> clear all
> input id str1 c1-c6
> 1 A B A A B B
> 2 B B A B A B
> end
> list, noobs
> reshape long c, i(id) j(r)
> fillin id r c
> g chosen=1-_fillin
> li, noo sepby(r)
> 
> 
> On Sat, Dec 5, 2009 at 10:10 AM, David Kantor wrote:
> > Without going into much detail, it seems that you want -reshape- followed by
> > -fillin-.
> > Possibly there are other operations needed as well.
> >
> > HTH
> > --David
> >
> > At 05:02 PM 12/4/2009, Shehzad Ali wrote:
> >>
> >> Hi listers,
> >>
> >> I would really appreciate some help with data structuring.
> >>
> >> I want to change my data structure from wide to long form. The data comes
> >> from a discrete choice experiment. Each individual is given 6 choice sets.
> >> Each choice set has two options, A or B. Individual is asked to choose
> >> between A and B for each choice set. The data currently looks like this:
> *
> *  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/



      

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index