Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Percent of time a


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Percent of time a
Date   Tue, 10 Feb 2009 20:23:42 -0000

I interpret this as meaning that you have time series data with
regularly spaced observations. If that's not true, what follows will
need modification. 

You need a weighted mean of an expression that would produce an
indicator variable. David Kantor's _gwtmean function for -egen- from SSC
will do that, but I don't know a command that will do this without
generating a new variable, but it's programmable. 

Nick 
[email protected] 

Howard Lempel

Is there a command that will give me the proportion of the time a
variable is equal to a certain value?  The command must accept weights.
I'm looking for something like -tabcond-, from SSC, but that returns
proportions as well as counts.

One option would be to -generate- a dummy equal to 1 when my variable is
equal to my value and zero otherwise and then to use -svy: mean-, but I
would prefer something that can be done in one line (and without
generating a new variable).  My variable is continuous, so I don't want
to -svy: tab- the whole thing.


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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