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

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



Partha S. Sarkar
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index