| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: Sample command question
At 09:10 PM 10/29/2006, David McClintick wrote:
Actually, I just realized that your suggestion isn't going to work. As I
am generating a sample based on each variable, and I have different
amounts of missing values for each variable, your command would drop all
observations that had any missing value for any one of the variables. I
only want to drop observations for that particular sample when missing
in that particular variable.
All the loops sort of confuse me so you may be right! But I guess I
don't see how that happens if the code is something like
local i=1
foreach x in var1-var91 {
while `i' <=10 {
use c:\ado\personal\easy.dta
keep if !missing(`x')
sample 5, count
save mewsample`i', replace
local i= `i' +1
}
}
You open a file, drop cases with MD on 1 variable, sample and save as
a new file, and then reopen the original file and repeat the process
for a total of 10 times, and then move on to a different x.
In any event, I am guessing that some sort of keep if statement
should be in there, even if I don't have the right one.
-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/