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

st: RE: Indicator Variable HELP!


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Indicator Variable HELP!
Date   Wed, 14 Sep 2005 21:37:44 +0100

An indicator variable, in the jargon I know, 
takes on one of two possible values. I am 
not clear whether that is what you really 
want here. 

What you may want is some variation on -floor(date/10)-. 

Nick 
[email protected] 

kelly johnson
 
> I have a variable, date (in %d format). There are numerous 
> observations with 
> the same date, although the number of observations with the 
> same date is not 
> constant. (also, there are gaps in the days). I want to 
> create an indicator 
> variable to group date in increments of 10 days. (for the 
> first 10 days, i 
> want the variable to be 1, the next 10 days, the observation 
> to be 2 and so 
> forth. Any help would be appreciated (if tried the -egen- seq 
> commands, but 
> haven't been able to get it to condition on date. Thank you!
 
> Date	Indicator
> 02Jan2005	1
> 03Jan2005	1
> 04Jan2005	1
> 05Jan2005	1
> 05Jan2005	1
> 05Jan2005	1
> 05Jan2005	1
> 05Jan2005	1
> 05Jan2005	1
> 05Jan2005	1
> 05Jan2005	1
> 05Jan2005	1
> 05Jan2005	1
> 05Jan2005	1
> 05Jan2005	1
> 05Jan2005	1
> 05Jan2005	1
> 06Jan2005	1
> 09Jan2005	1
> 09Jan2005	1
> 09Jan2005	1
> 09Jan2005	1
> 10Jan2005	1
> 10Jan2005	1
> 10Jan2005	1
> 10Jan2005	1
> 10Jan2005	1
> 10Jan2005	1
> 10Jan2005	1
> 10Jan2005	1
> 10Jan2005	1
> 11Jan2005	1
> 11Jan2005	1
> 11Jan2005	1
> 11Jan2005	1
> 11Jan2005	1
> 11Jan2005	1
> 12Jan2005	1
> 13Jan2005	1
> 13Jan2005	1
> 13Jan2005	1
> 14Jan2005	1
> 15Jan2005	2
> 16Jan2005	2

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