Statalist


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

Re: st: wide to long form


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: wide to long form
Date   Sat, 5 Dec 2009 11:55:11 -0500

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 <kantor.d@att.net> 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/



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