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 at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Thread-Index: AcsBvuIZsv48hZwTRSGxCrT1fAtTUQ==


From   "Wald,Kenneth D" <kenwald@ufl.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Thread-Index: AcsBvuIZsv48hZwTRSGxCrT1fAtTUQ==
Date   Tue, 1 Jun 2010 15:16:05 -0400

Simple as it seems, I'm having a problem understanding how to assign missing values to a Stata dataset that did not have any missing values designated when it was created. I've gone through the FAQs and documentation but most of it seems to apply to cases where a missing value was designated during data input, not my situation.

The variable "q50h" has legitimate values of 1-10 and values of 0 and 11 for cases that I want to consider missing. The simplest way I've found to do this is by this command:

replace q50h=. if (q50h==0)|(q50h==11)

This works but I have the feeling there should be a more efficient way to do this for a large number of variables. I know I could simplify a bit by placing "q50h>=1 & q50h<=10" after the "if" but that's not much more efficient.  

Thanks for any advice. 

Kenneth D. Wald
University of Florida


Kenneth D. Wald
Distinguished Professor of Political Science
University of Florida
POB 117325
Gainesville, FL 32611-7325
Phone: 352-273-2391
Fax: 352-392-8127 
Home Page: www.clas.ufl.edu/users/kenwald



*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index