Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: Generating subsamples according to a binary choice


From   Michael Ingre <[email protected]>
To   [email protected]
Subject   Re: st: Re: Generating subsamples according to a binary choice
Date   Sat, 1 Nov 2003 19:29:17 +0100

You have two options with the if statement in almost all stata commands. Note the comma -,- sign:

command xvar yvars , options , if statement
command xvar yvars if statement , options

Michael



Thank you.
It surely works in case of a simple regression model.
Do you have a good idea to do the same in case of a 2step regression model such as zip(zero inflated poisson) or zinb(zero inflated negative binominal) where I obtain "if invalid r(198);" from Stata7?


--- [email protected] ---


--- [email protected] wrote:
Dear Statalisters,
I want to classify the sample into two parts accoding to a
dichotomy variable and apply them a same regression model.
For instance, I want to divide the sample into the subsample A
where a dummy takes one and the subsample B where a dummy takes
zero. I do this by generating two new worksheets for subsamples
A&B in MS-Excel, and then run a regression twice in Stata7.
How do I do these procedures using only Stata instead of generating
new worksheets in Excel?
Thank you in advance.
Nobuya Fukugawa
Is this what you need?

. sysuse auto
. regress mpg weight if foreign==1
. regress mpg weight if foreign==0

Friedrich Huebler


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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index