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

Re: st: how to compare the values of a variable at different observations


From   Richard Williams <[email protected]>
To   [email protected]
Subject   Re: st: how to compare the values of a variable at different observations
Date   Mon, 18 Jul 2005 10:26:25 -0500

At 10:55 AM 7/18/2005 -0400, sarah smith wrote:
Dear STATA users,

I wonder how I can compare the values of a variable, say var1, at
different observations? (In particular I want to do regressions such
as the one below)

if var1(at line 2) = var1(at line 10 ) {

regress y x in 2/10
}

Thanks for suggestions,
Sarah
Hi Sarah. First off, better to start a new thread than to reply to an old one and then change the title. But, if you do reply, at least delete all the material that is irrelevant to your post!

Can you clarify the goal here? Do you want to do cases 2 through 10, then 11 thru 19, then 20 to 28, or what? Or do you just literally want to run a regression on cases 2 thru 10? (If so, visual inspection may be easier than trying to program it.)

In your problem as stated, you could do

regress y x in 2/10 if var1[2]==var1[10]

But, I suspect what you want to do is more complicated than that.


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc

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