POLMETH Archives

Political Methodology Society

POLMETH@LISTSERV.WUSTL.EDU

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Kenneth Benoit <[log in to unmask]>
Reply To:
Political Methodology Society <[log in to unmask]>
Date:
Wed, 20 Sep 2006 16:06:16 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (112 lines)
if you have DV coded as byte so that
. label list DV
DV:
            1 a
            2 b
            3 c

then

reshape wide DV, i(ID) j(ref)
replace DV2=2 if (DV1==1 | DV1==3)
replace DV2=1 if DV1==2
replace DV3=1 if (DV1==2 & DV2==3) | (DV2==2 & DV1==3)
replace DV3=2 if (DV1==3 & DV2==1) | (DV2==3 & DV1==1)
replace DV3=3 if (DV1==1 & DV2==2) | (DV2==1 & DV1==2)
reshape long DV, i(ID) j(ref)


it's a kludge but works

Ken

Kenneth Benoit
Associate Professor of Political Science
Department of Political Science, Trinity College
Dublin 2, Ireland
http://benoit.tcd.ie
Tel: 353-1-896-2491
Fax: 353-1-677-0546



Kamilah khatib, LSE wrote:
>
> Dear political methodologists,
>
> I am a phd student at the LSE who seeks some (simple) help in STATA.
>
> I used the reshape command because I need to run a conditional logit model (also called mixed logit, Mc Fadden conditional Model, Luce model...you name it)
>
> the data I have now looks like this (where dv is my dep variable)
> ID  DV  ref
> 1     a    1
> 1     .     2
> 1     .     3
> 2     b    1
> 2     .     2
> 2     .     3
> 3     a    1
> 3      .    2
> 3      .    3
> 4      c   1
> 4      .    2
> 4      .    3
> .
> .
> .
> What I want to do is to fill those missing data with a, b, or c (order does not matter) depending on the data available (i.e b, and c if I have a, a and b if I have c, a and c, if I have b). In other words make it look like the following:
>
> ID  DV
> 1     a
> 1     "b"or "c"
> 1     "c"      "b"
> 2     b
> 2     "a"or "c"
> 2     "c"     "a"
> 3     a
> 3      "b" or "c"
> 3      "c"      "b"
> 4      c
> 4      "a"or "b"
> 4      "b"     "a"
> .        .
> .        .
> .        .
>
>
> thank you very much for your help!
> Kamilah
> ----------------------------
> Kamilah KHATIB
> PhD candidate
> Government Department
> London School of Economics
> WC2A 2AE
>
>
> **********************************************************
>              Political Methodology E-Mail List
>         Editor: Karen Long Jusko <[log in to unmask]>
> **********************************************************
>         Send messages to [log in to unmask]
>   To join the list, cancel your subscription, or modify
>            your subscription settings visit:
>
>           http://polmeth.wustl.edu/polmeth.php
>
> **********************************************************
>

**********************************************************
             Political Methodology E-Mail List
        Editor: Karen Long Jusko <[log in to unmask]>
**********************************************************
        Send messages to [log in to unmask]
  To join the list, cancel your subscription, or modify
           your subscription settings visit:

          http://polmeth.wustl.edu/polmeth.php

********************************************************** 

ATOM RSS1 RSS2