Bookmark and Share

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: reshaping help


From   "Paul O'Brien" <[email protected]>
To   statalist <[email protected]>
Subject   st: reshaping help
Date   Tue, 25 May 2010 22:40:12 +0100

i find the reshape command difficult to use, and have tried many commands without success.

Study	Day	t1	t2	p1	np1	all1	p2	np2	all2
Ho&Kwan	1	LNG	Yuzpe	3	214	217	4	213	217
Ho&Kwan	2	LNG	Yuzpe	6	124	130	4	110	114
WHO 	1	LNG	Yuzpe	2	448	450	9	450	459
WHO 	2	LNG	Yuzpe	4	334	338	15	355	370

each row represents the day of treatment, the treatments (1 and 2), the number of pregnancies with each treatment, the number not pregnant and all exposed for each treatment.

i need each row to represent one day/treatment:
Study	Day	t	pop	p
Ho&Kwan	1	LNG	214	0
Ho&Kwan	2	LNG	124	0
Ho&Kwan	1	Yuzpe	213	0
Ho&Kwan	2	Yuzpe	110	0
Ho&Kwan	1	LNG	3	1
Ho&Kwan	2	LNG	6	1
Ho&Kwan	1	Yuzpe	4	1
Ho&Kwan	2	Yuzpe	4	1

so that i can then expand to get one observation per row.

i can do this in Excel but frequently need to reorganise summary trial data like this and want to do it in Stata, thinking there must be an easier way.

help appreciated.

thanks,

paul




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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index