Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
maria pilar <maria.pilar@lycos.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Reshape long multiple variables per year (semesters) |

Date |
Sun, 11 Nov 2012 04:27:44 +0000 (UTC) |

I have a database that tracks disbursements twice a year (june and december), and the variables (columns) appeared as JUN93, DEC93, JAN95, DEC94, and so on. Each project can last several years. I renamed the semesters x (june) and y (december). It looks like this Operationnumber TYPE x1993 y1993 x1994 y1994 x1995 y1995 x1996 y1996 x1997 a DEL 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 b DEL 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 c DEL 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 d DEL 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 e DEL 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 I tried the following, and go some message I do not understand (any insights appreciated) . reshape long x y, i(operationnumber) j(year) (note: j = 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 > 2006 2007 2008) y1998: 26 values would be changed; not changed x1999: 20 values would be changed; not changed y1999: 22 values would be changed; not changed x2000: 20 values would be changed; not changed y2000: 24 values would be changed; not changed y2001: 229 values would be changed; not changed x2002: 195 values would be changed; not changed y2002: 268 values would be changed; not changed x2003: 225 values would be changed; not changed x2007: 258 values would be changed; not changed Data wide -> long ---------------------------------------------------------------------------- > - Number of obs. 1525 -> 24400 Number of variables 34 -> 5 j variable (16 values) -> year xij variables: x1993 x1994 ... x2008 -> x y1993 y1994 ... y2008 -> y ---------------------------------------------------------------------------- > - And the database now looks like operationnumber year type x y a 1993 MIF 0 0 a 1994 MIF 0 0 a 1995 MIF 0 0 a 1996 MIF 0 0 a 1997 MIF 0 0 a 1998 MIF 0 0 a 1999 MIF 0 625000 a 2000 MIF 0 0 b 1993 MIF 0 0 b 1994 MIF 0 0 b 1995 MIF 0 0 b 1996 MIF 0 0 b 1997 MIF 0 0 b 1998 MIF 0 0 b 1999 MIF 0 0 b 2000 MIF 0 0 However this is not what I need. I'd like something like this operationnumber year type disbursement a x 1993 MIF 0 a y 1993 MIF 0 a x 1994 MIF 0 a y 1994 MIF 0 a x 1995 MIF 0 a y 1995 MIF 0 b x 1993 MIF 0 b y 1993 MIF 0 b x 1994 MIF 0 b y 1994 MIF 0 b x 1995 MIF 0 b y 1995 MIF 0 If it makes sense... Thanks to all! * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: Reshape long multiple variables per year (semesters)***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**Re: st: prtest confidence interval** - Next by Date:
**Re: st: Reshape long multiple variables per year (semesters)** - Previous by thread:
**st: logistic regression and interpreting trend across two time points** - Next by thread:
**Re: st: Reshape long multiple variables per year (semesters)** - Index(es):