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

RE: st: how to show counts of zero for entries that don't exist?


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   RE: st: how to show counts of zero for entries that don't exist?
Date   Sun, 9 Oct 2005 18:26:58 -0500

Here is one way:


clear
input id year count
1 1981 1
1 1999 2
1 2000 3
2 1981 7
2 1999 8
3 2000 9
end

tsset id year
tsappend, add(6)

local j = 24
forv i = 2004/2006 {
	replace year = `i' - `j' if year == `i'
	local j = `j' + 2 
}

tsfill, full
replace count = 0 if count ==.

Hope this helps,
Scott


> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Andre pierre
> Sent: Sunday, October 09, 2005 5:22 AM
> To: [email protected]
> Subject: st: X-OriginalArrivalTime: 09 Oct 2005 10:22:11.0747 (UTC)
> FILETIME=[4FAAC730:01C5CCBB]
> 
> how to show counts of zero for entries that don't exist?
> Date: Sun, 09 Oct 2005 12:22:11 +0200
> Mime-Version: 1.0
> Content-Type: text/plain; charset=iso-8859-1; format=flowed
> 
> Dear all,
> 
> I have a dataset covering the period 1978-2003, that only reports the
> observations for which the count variable is strictly greater than zero.
> In
> the following example, I would like to set the "count" variable to zero
> for
> the years that are not repoted between 1978 and 2003
> 
> 
> ID; year; count
> .
> .
> .
> 3; 1981; 6
> 3; 1999; 10
> 3; 2000; 11
> .
> .
> .
> 
> Thanks for your help,
> Andr�
> 
> _________________________________________________________________
> Tout savoir sur la s�curit� de vos enfants sur Internet !
> http://go.msn.fr/10-channel/80-security/protection/default.asp
> 
> *
> *   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