Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: reshaping panel data


From   "Earnhart, Benjamin J" <[email protected]>
To   <[email protected]>
Subject   st: reshaping panel data
Date   Thu, 7 Sep 2006 16:50:42 -0500

I'm posting the message below on behalf of a colleague who, for some reason, is unable to it post herself.  She can *receive* messages no problem, but when she posts, nothing happens.  She's tried it from her va.gov address as well as a gmail account we set up.  So substantive answers to her question would be appreciated of course, but clues as to why it won't let her post would also be great.

Thanks!   

*==========================================;
*Ben Earnhart
*Computer Consultant and 
*ICPSR Representative
*Department of Sociology and 
*College of Liberal Arts
*University of Iowa
*(319) 335-2887
*[email protected]
*==========================================; 

> -----Original Message-----
> From: Richardson, Kelly K. [mailto:[email protected]] 
> Sent: Thursday, September 07, 2006 4:36 PM
> To: Earnhart, Benjamin J
> Subject: reshaping panel data
> 
> Hi Stata Listers,
> 
> I need to run a�gee regression and a multinomial logit on 
> panel data (3 time periods per person). I am trying to 
> reshape the data so that there are three lines per person. 
> However, when I use the reshape function in Stata I get 
> something else. I was looking at SAS code a colleage of mine 
> wrote to accomplish the same task and I tried to replicate it 
> using Stata but that didn't work either. I looked in the 
> Statalist archives but I couldn't find what I was looking for 
> so I'm putting the question to you. 
> �
> 
> Here's an example of the statistical models I want to run: 
> regress change in depression2002 on change in weight2000 
> controlling for weight1998��
> regress change in depression2000 on change in weight1998 
> controlling for weight1996 
> regress change in depression1998 on change in weight1996 
> controlling for weight1994 
> �
> The models look like this:
> �
> xtgee chdep chwt wt, family(binomial) link(logit) 
> corr(independent) i(id) robust
> �
> OR
> �
> mlogit chwt�chdep wt, robust cons(1) noconstant cluster(id)
> �
>       �
> Currently the data set looks like this:
> id chdep02 chdep00 chdep98 chwt00 chwt98 chwt96 wt98 wt96 wt94 
> 1
> 2
> 3
> I want the data to look like this:
> id�������� chdep � chwt���� 	wt������� 
> 1��������� 02������� 00������� 98������� 
> 1��������� 00������� 98������� 96������� 
> 1��������� 98������� 96������� 94������� 
> �
> When I do reshape in Stata I get: 
> �id��������chdep � chwt����   wt������� 
> 1��������� 02������������������������������� 
> 1��������� 00������� 00������������������� 
> 1��������� 98������� 98�������98������� 
> 1��������������������96�������96������� 
> 1�����������������������������94������� 
> �
> I can create the structure I need by using a series of 
> recodes but that leaves too much room for error and it 
> doesn't easily translate from one project to another. I 
> figured if SAS can do it with some simple arrays Stata 
> probably can too. 
> �
> I appreciate any suggestions you can give. 
> �
> Thanks,
> Kelly
> 
> 
> 
> 
>  
> 
> 

*
*   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/



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