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]
Re: st: create one factor level from two existing
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: create one factor level from two existing
Date
Wed, 26 Dec 2012 19:02:57 +0000
This should help:
SJ-7-4 dm0034 . . . Stata tip 52: Generating composite categorical variables
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
Q4/07 SJ 7(4):582--583 (no commands)
tip on how to generate categorical variables using
tostring and egen, group()
A .pdf version is accessible at
http://www.stata-journal.com/sjpdf.html?articlenum=dm0034
Nick
On Wed, Dec 26, 2012 at 5:37 PM, Lane, Scott D <[email protected]> wrote:
> I have a design with 2 placebo (plc) doses (a baseline plc, designated 1, to familiarize/stabilize subjects on a lab task) plus three CNS-active doses and an additional plc dose (designated 2-5 and counterbalanced). Performance on the 2 placebo doses is highly correlated and I thus wish the combine the 2 placebos into 1 plc factor in the analytic model (e.g., dose with 4 levels). In the .dat file, the data are in long format with several other DVs and IVs for each subject. Please advise re: how to use egen (or some other technique) to pull this off? To date, I have tried:
> 1. egen rowmeans for each of the 2 plc doses, then attempted, by subject, to average the 2 newly created variables (result = a variable of blank values).
> 2. reshape to wide format, then use egen rowmeans (result = error message stating that most of the other IVs and DVs cannot be reshaped to wide format). Thus, I cannot get started without deleting many other variables.
>
*
* 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/