Bookmark and Share

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]

st: Collapse error: "Factor variables not allowed"


From   Lynne Morgan <lmorgan3@wisc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Collapse error: "Factor variables not allowed"
Date   Tue, 11 Dec 2012 10:27:19 -0600

Hi All,

I have a dataset that I need to collapse by the id number because each ID has several rows (hhidnum). Mostly I just want to know the sum, because the variables are if a condition is present or absent (1/0) in the various rows for each ID. Here is the code that I run:

*Collapse by HHID
collapse (sum) segmentnum SBE_SEGLEN SBE_1A SBE_1B SBE_1C SBE_1D SBE_1E SBE_1F /// diSBE_12A diSBE_12B diSBE_12C diSBE_12D diSBE_12E diSBE_12F diSBE_12G diSBE_12H ///
    SBE_11A SBE_11B SBE_11C SBE_11D SBE_11E  littersmall litterhaz ///
    (mean) meanmph=SBE_5A meanlanes=SBE_7A ///
    by(hhidnum) cw

The error I get, though, is "factor variables not allowed". What does this mean? How do I get around it?

Thanks so much!

--
Lynne Morgan, MPH
Assistant Researcher
Survey of the Health of Wisconsin
University of Wisconsin, Madison
(e) lmorgan3@wisc.edu
(p) 608-821-1243

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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index