Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: issues with tsset based on more than a time variable and duplicates conflicting results |
Date | Mon, 20 Jan 2014 17:55:00 +0000 |
OK; that rules out that idea. No more ideas from me, sorry. Nick njcoxstata@gmail.com On 20 January 2014 17:47, Abdalla, Ahmed <ahmed.abdalla@kcl.ac.uk> wrote: > Sorry I forgot to write that I get > > . tabmiss mth if mth<1 > Variable | Obs Missings Feq.Missings NonMiss Feq.NonMiss > -------------+--------------------------------------------------------------- > mth | 0 0 . 0 . > > . tabmiss mth if mth>12 > Variable | Obs Missings Feq.Missings NonMiss Feq.NonMiss > -------------+--------------------------------------------------------------- > mth | 0 0 . 0 . > > Is that what you mean ? > Nick, do you think I can any more investigation to track why these results are conflicting ? > > > > ________________________________________ > From: owner-statalist@hsphsun2.harvard.edu <owner-statalist@hsphsun2.harvard.edu> on behalf of Nick Cox <njcoxstata@gmail.com> > Sent: 20 January 2014 17:43 > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: issues with tsset based on more than a time variable and duplicates conflicting results > > You haven't reported on whether there are non-missing values of -mth- > other than 1 to 12, i.e. <1 and >12. > > There is only one way to -tsset- panel data, with a panel identifier > and a time identifier. There is no syntax for three variables; the > -help- tells you that. > > Nick > njcoxstata@gmail.com > > > On 20 January 2014 17:38, Abdalla, Ahmed <ahmed.abdalla@kcl.ac.uk> wrote: >> I run- tabmiss firmid timeid- and -tabmiss permno yr mth- and find no missing values in both cases. >> I run again duplicates report permno yr mth-and-duplicates report firmid timeid- in the fist case, I get no duplicates, however in the second case I get 510,000 duplicates !! >> >> Can I tsset my panel based on permno yr mth, and avoid the grouping I have done? >> >> >> >> ________________________________________ >> From: owner-statalist@hsphsun2.harvard.edu <owner-statalist@hsphsun2.harvard.edu> on behalf of Nick Cox <njcoxstata@gmail.com> >> Sent: 20 January 2014 17:28 >> To: statalist@hsphsun2.harvard.edu >> Subject: Re: st: issues with tsset based on more than a time variable and duplicates conflicting results >> >> A wild guess is to check for missing values on these variables, and >> for rogue values of -mth- (missing, <1, >12). >> >> Nick >> njcoxstata@gmail.com >> >> >> On 20 January 2014 17:10, Abdalla, Ahmed <ahmed.abdalla@kcl.ac.uk> wrote: >>> Dear Statalist >>> I want to tsset my data based on permno yr mth: >>> I tried - tsset permno yr mth - I get the error message "too many varaibles specified" >>> I tried - gen firmid= group(permno) >>> gen timeid = ym(yr, mth) >>> tsset firmid timeid - I get the error " repeated time values with panel >>> So I tried to investigate my duplicates : >>> I run the command: >>> duplicates report firmid timeid >>> I get >>> copies | observations surplus >>> ----------+--------------------------- >>> 1 | 2181223 0 >>> 2 | 53712 26856 >>> 3 | 16515 11010 >>> 4 | 9556 7167 >>> 5 | 5510 4408 >>> 6 | 1698 1415 >>> 7 | 196 168 >>> 8 | 48 42 >>> 9 | 18 16 >>> >>> I drop my duplicates and tsset my data, it works properly. But I though to investigate the duplicates again and run this code (of course before dropping my duplicates): >>> duplicates report permno mth yr, I get: >>> >>> copies | observations surplus >>> ----------+--------------------------- >>> 1 | 2268476 0 >>> >>> >>> Why both duplicates drop based on firmid and timeid versus permno yr mth are different though the firm id groups permno and the timeid groups yr and mth ? >>> Is there any other way to tsset my data based on permno yr mth rather than the grouping I have done (firmid and timeid) ? >>> >>> >>> Thanks >>> >>> >>> >>> >>> >>> >>> * >>> * For searches and help try: >>> * http://www.stata.com/help.cgi?search >>> * http://www.stata.com/support/faqs/resources/statalist-faq/ >>> * http://www.ats.ucla.edu/stat/stata/ >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/faqs/resources/statalist-faq/ >> * http://www.ats.ucla.edu/stat/stata/ >> >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/faqs/resources/statalist-faq/ >> * http://www.ats.ucla.edu/stat/stata/ > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/