| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: why do I lose data, and changes my data when I create new variables and recode missing variables
From |
[email protected] |
To |
[email protected] |
Subject |
st: why do I lose data, and changes my data when I create new variables and recode missing variables |
Date |
Mon, 2 Apr 2007 13:23:56 +0100 (BST) |
why do I lose data when I create new variables and recode missing variables?
First I replace all my variables like this for example: replace turngrow=.
if turngrow==-999
(2307 real changes made, 2307 to missing)
Then I have a variable gdivs (percentage of females in companies)
When I summarize gdivs the mean is=26.98899
Variable Obs Mean Std. Dev. Min max
gdivs 3249 26.98899 32.9987 0 100
I want to create a variable that shows gdivs into 5 categories:
generate genderdivs = .
(3448 missing values generated)
replace genderdivs = 1 if (gdivs == 0)
(3253 real changes made)
replace genderdivs = 2 if (gdivs > 0) & (gdivs <25)
(82 real changes made)
replace genderdivs = 3 if (gdivs >= 25) & (gdivs <50)
(319 real changes made)
replace genderdivs = 4 if (gdivs >= 50) & (gdivs <75)
(825 real changes made)
replace genderdivs = 5 if (gdivs >= 75) & (gdivs <.)
(344 real changes made)
When I tabulate genderdivs 5 categories are displayed:
genderdivs Freq. Percent Cum.
1 1,679 51.68 51.68
2 82 2.52 54.20
3 319 9.82 64.02
4 825 25.39 89.41
5 344 10.59 100.00
Total 3,249 100.00
Now when I close STATA, save it under a new name and open it again another
time the mean for gdivs changes from 26.98899 to a lower value. Sometimes
21, sometimes 10.91 (I tries it a couple of times)
And when I tabulate genderdivs 6 categories appear (a zero category is
included although I didnt command for that), instead of 5 (which I want)
What do I do wrong? Is there something wrong with how I save or open
things? Or with my commands?
Appreciate your help!
*
* 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/