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: Collapse error: "Factor variables not allowed"


From   Lynne Morgan <[email protected]>
To   [email protected]
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) [email protected]
(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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index