Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Creating loops to drop observations each time regression is run


From   "Thuy Le" <[email protected]>
To   <[email protected]>
Subject   st: RE: Creating loops to drop observations each time regression is run
Date   Sat, 01 Apr 2006 11:32:06 -0500

You can use the 'foreach'. See help on 'foreach' for details. 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Samia Tavares
Sent: Saturday, April 01, 2006 10:29 AM
To: [email protected]
Subject: st: Creating loops to drop observations each time regression is run

Hi everyone!

I have a panel consisting of different countries for a number of years. I am
trying to write a program that would tell Stata to run a regression while
each time dropping a particular country (in other words, all the years for
which that country has observations). All I have so far is the manual
version:

use dataset.dta, clear
drop if code=="country1"
regress y x

use dataset.dta, clear
drop if code=="country2"
regress y x

and so forth. I am clueless as to how to write programs, so any help will be
immensely appreciated!!

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