![]()  | 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: reshape from wide to long form
From 
 
Evans Jadotte <[email protected]> 
To 
 
[email protected] 
Subject 
 
Re: st: reshape from wide to long form 
Date 
 
Sat, 05 Dec 2009 12:30:33 +0100 
Shehzad Ali wrote:
Hi listers,
I would really appreciate some help with data structuring/reshaping.
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, and the individual is asked to choose between the two options for each choice set. The data currently looks like this:
id    choice_in_set1    choice_in_set2    choice_in_set3    choice_in_set4    choice_in_set5    choice_in_set6
1            A                        B                          A                        A                      B                        B
2            B                        B                          A                        B                      A                        B
I want the data to look like this:
id    choice_set    alternative    chosen (yes/no)
1            1                A                    1
1            1                B                    0
1            2                A                    0
1            2                B                    1
1            3                A                    1
1            3                B                    0
..
..
2            1                A                    0
2            1                B                    1
2            2                A                    0
2            2                B                    1
...
...
Any help would be greatly appreciated.
Many thanks,
Shehzad
      
*
*   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/
  
. reshape long
without arguments automatically does this for you. You can also use an 
identifier , i(varname), by which you ask Stata to reshape the data set 
for you.
Hope this helps,
Evans Jadotte
begin:vcard
fn:Evans  Jadotte
n:Jadotte;Evans 
org;quoted-printable:Universitat Aut=C3=B2noma de Barcelona ;Applied Economics
adr:;;Campus de Bellaterra;Bellaterra;Barcelona;08193;Spain
email;internet:[email protected]
tel;work:+34 93 5813415
tel;fax:+34 93 5812292
tel;cell:+34 655319494
version:2.1
end:vcard
| © Copyright 1996–2025 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |