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]

Re: st: factor variables may not contain negative values


From   William Buchanan <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: factor variables may not contain negative values
Date   Fri, 16 Aug 2013 06:08:23 -0500

There is no reason for the categories to contain negative values.  In this case, it would probably be more appropriate to reconsider your coding scheme.  I would strongly consider using the extended missing values in this case since you know why the valid response does not exist:

recode x (-9 = .a)(-6 = .b)
la def labelsx .a "Does Not Know" .b "In Progress" 1 "Yes" 2 "No"
la val x labelsx

In either case, there is no reason to use negative values for this variable if the numeric values have no inherent meaning about the scale/unit of measurement.

HTH,
Billy

Sent from my iPhone

On Aug 16, 2013, at 5:52, malay biswas <[email protected]> wrote:

> Dear All,
> Could please tell meas to how stata operates in the following situation.
> 
> I have data set containing codes for missing data and other contingencies.
> 
> Yes= 1
> No = 2
> Do Not Know = -9 (Minus)
> Still in Progress= -6(Minus)
> 
> When conducting interaction with other variables having similar coding
> arrangements, I get stata notification that "factor variables may not
> contain negative values."
> 
> Could you please tell me what is happening?
> 
> Thank you for your continued support.
> Regards
> Malay
> *
> *   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/

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