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

st: St:Selecting observations


From   "Apostolos Ballas" <[email protected]>
To   [email protected]
Subject   st: St:Selecting observations
Date   Sat, 8 Jan 2005 10:53:16 +0200

Dear all,

I am interested to do a statistical analysis repeteadly for a number of
companies. The observations are organized as follows:

Country 	Id	Numerical Data
UK		1
UK		2
UK		3
.
.
.
France		101
France		102
.

and so on for other EU countries.

I want to run a regression from which I will exclude company X but use data
from all other companies in the same country. My solution is as follows:

gen byte iscountry=0
sort id year
gen obs=_n
by id: gen obs_no=_n
by id: gen obs_lot=_N
sort obs_no id
gen comp_no=_n if obs_no==1
sort obs
replace comp_no=comp_no[_n-1] if comp_no >=.
forval i=1/1302 {
replace iscountry=0
replace iscountry=1 if comp_no==`i'
bysort country (iscountry): replace iscountry = iscountry[_N]
sureg .......          if comp_no!=`i' & iscountry==1, robust
}

Is this the best possible approach? Indeed, is it a correct approach?

Thanks for all assistance.

Apostolos


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