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

st: RE: RE: Check existence within a group


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Check existence within a group
Date   Fri, 7 May 2004 18:42:26 +0100

de la Garza, Adrian
 
> Nick, thank you very much. I was not familiar with this structure of
> generating variables by assigning them a value and adding extra
> conditions, like this:
> 
> _n > 1
> 
> I think I still need time to digest this as I don't 
> understand very well
> the structure behind this command. It has certainly been very useful,
> though. Thank you.

Think of this as an expression to be evaluated. It doesn't come 
as two parts, 

_n 

and 

> 1 

Rather it comes as one expression. Think of it as 

(_n > 1) 

if you wish. Either way, the FAQ at 
http://www.stata.com/support/faqs/data/trueorfalse.html
may be useful. This material was also presented in 
a tutorial on -by:- in Stata Journal 2(1), 2002. 

> And just a comment about the way I want to construct this 
> dummy (I guess
> you would code 1 for new and 0 for old), think of it as if the dummy
> signaled when the borrower has already "experience" in a particular
> market type. This construction is better for our own regression
> interpretation purposes.

No doubt. Let me expand on my comment. What I should have flagged 
more explicitly is a rule of thumb often used: the name of the dummy 
variable should match whichever state is 1. In my experience, having 
it the other way round imposes more mental strain and every now and 
again you forget the twist that you applied. 

Naturally, your variable names are under 
your control, but in your circumstances, as I'm looking on, 
I would recommend changing the name. 


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index