[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: different n's using "if"
> -----Original Message-----
> From: Sarah A. Mustillo [mailto:email@example.com]
> Sent: Thursday, October 31, 2002 4:26 PM
> To: firstname.lastname@example.org
> Subject: st: different n's using "if"
> Hi -
> This question is probably an easy one, but I am baffled...
> I am trying to run GEE models for subsets of my sample
> separately: white
> girls, black girls, white boys, and black boys. I have been
> using an "if"
> statement before the comma in the regression model, e.g., if
> sex==0&race==1, etc. I should also mention that I am
> limiting the sample
> by time of observation as well, so what I really have is: if
> sex==0&race==1&period==1|2, for example. I started getting
> suspicious that
> I wasn't doing what I wanted to do when my sample size stayed
> large. So, I
> tried preserving the data set, the dropping male and black
> and running the
> model again, and the n was much smaller.
> My question:
> Shouldn't using "if" before the comma accomplish the same
> thing as dropping
> those people from the sample? What am I missing?
> Below are my examples:
> xi: xtgee pul per2Xlagccm period2 lagccm age if
> sex==0&racewh==1&period==1|2 [pweight=wt], robust corr(exch)
You've got a problem with your "period==1|2". It needs to be (with
spaces to make things easier to read:
sex==0 & racewh==1 & (period==1 | period==2)
YOu can't do "something==this|that"; you need to do "something==this |
or use the inlist function: inlist(something,this,that).
Your confusing results occurs because Stata is evaluating:
(sex==0&racewh==1&period==1) | (2)
and (2) is always true.
* For searches and help try: