Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: reshape query
From
Tim Evans <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
st: reshape query
Date
Tue, 4 Dec 2012 12:30:34 +0000
Hi all,
I'm using Stata 11.2, and am having a little trouble with -reshape-.
I have a dataset with data as such:
year age Males age mmx mqx mlx mdx mex Females fmx fqx flx fdx fex
1982 0.00 Males 0.00 0.01 0.01 100000.00 1281.70 70.81 Females 0.01 0.01 100000.00 994. 76.80
I want to set the data up so that I have:
Year Sex age mx qx lx dx ex
1982 Males 0 0.01 0.01 100000.00 1281.70 70.81
1982 Females0 0.01 0.01 100000.00 994.0 76.80
I've been trawling a few bits of code that I have used in the past and not finding a solution:
g id=_n
reshape long m f, i(id age year) string
But this gives this output:
id age year _j m f
1 0 1982 dx 1281.7 994.7
1 0 1982 ex 70.81 76.8
1 0 1982 lx 100000 100000
1 0 1982 mx .0129 .009997
1 0 1982 qx .012817 .009947
I'm sure I probably need another -reshape- around _j
Best wishes
Tim
_DISCLAIMER:
This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.
*
* 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/