Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: Re: Analyzing time series data on prices by districts & markets


From   Partho Sarkar <partho.ss@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: Analyzing time series data on prices by districts & markets
Date   Tue, 14 Jun 2011 12:24:08 +0530

Hello Chris,

The code worked fine, except for this section:

The number of districts in each state for which prices are
reported, versus the total no. of districts in that state

egen districttag = tag(district)
bysort state: egen numdistricts = total(districttag)
bysort state date: egen districtswithprices = total(districttag)
gen percentdistrictswithprices = districtswithprices/numdistricts

 I am getting many false zero values for districtswithprices, as seen
in this extract from the output:

The headers for the 7 columns: reportdate	state mandi
district	mandisopen	numdistricts	districtswithprices

06/01/09	Andhra	Addank	Prakas	3	8	6
06/01/09	Andhra	Bhimav	West G	2	8	6
06/01/09	Andhra	Kothav	Vizian	2	8	6
06/02/09	Andhra	Atmaku	Kurnoo	1	8	0
06/02/09	Andhra	Kondap	Prakas	2	8	0
06/02/09	Andhra	Satten	Guntur	1	8	0


Clearly, if mandisopen>0, districtswithprices =0 can't be right.
Wonder if you can spot the problem with the code without too much more
trouble.

And thank you, Dr. Cox- I had a glance at the article, and will go
through it carefully- it looks quite insightful.

Regards,

Partho

Partha S. Sarkar
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index