# Re: st: Why does one command "lose" observations compared to anothercommand?

 From Suzy To statalist@hsphsun2.harvard.edu Subject Re: st: Why does one command "lose" observations compared to anothercommand? Date Sun, 22 Jan 2006 14:16:50 -0500

Hi Mike and Richard,

I used the same weight variable (mecwt4) for both the svy and non-svy commands. Also Stata on my PC is up to date as of a few days ago.

However, I did just now use a different weight variable for the non-svy command that I know for certain is 100% present for these variables. I did get back the proper # of observations (N=11,400). The point estimates are exactly the same as before.

If the mecwt4 variable loses some observations (which is certainly possible), why didn't it also lose those observations for the svy command? In other words, shouldn't the svy command output have been = Subpop. no. obs = 10,568 rather than the 11,441?

Thank you for helping troubleshoot the problem!

mean age [pweight = wtint4yr] if age>=18, over(race)

Mean estimation Number of obs = 11441

1: race = 1
2: race = 2
3: race = 3
4: race = 4
5: race = 5

--------------------------------------------------------------
Over | Mean Std. Err. [95% Conf. Interval]
-------------+------------------------------------------------
age |
1 | 46.85757 .2383408 46.39039 47.32476
2 | 42.29386 .3367213 41.63383 42.95389
3 | 36.83151 .2716038 36.29912 37.3639
4 | 41.38075 .8945132 39.62735 43.13415
5 | 41.87601 .7078475 40.4885 43.26351
--------------------------------------------------------------

Michael S. Hanson wrote:

```On Jan 22, 2006, at 11:56 AM, Suzy wrote [slightly edited]:

```
I have come across a problem that I can't figure out. I don't know why I am "losing" 873 observations with one stata command versus the other - for mean age by race, if age>=18. Both age and race are 100% present in the total dataset - total (N=21004) and for age>=18 (N=11,441).

Any insight into this would be greatly appreciated.

svy, subpop(if age>=18): mean age, over(race)

mean age [pweight = mecwt4] if age>=18, over(race)

Have you examined mecwt4 to confirm that it has all 11441 observations in your restricted sample?

-- Mike

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

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