Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: issues with tsset based on more than a time variable and duplicates conflicting results
From
"Abdalla, Ahmed" <[email protected]>
To
"[email protected]" <[email protected]>
Subject
RE: st: issues with tsset based on more than a time variable and duplicates conflicting results
Date
Mon, 20 Jan 2014 17:38:40 +0000
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: [email protected] <[email protected]> on behalf of Nick Cox <[email protected]>
Sent: 20 January 2014 17:28
To: [email protected]
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
[email protected]
On 20 January 2014 17:10, Abdalla, Ahmed <[email protected]> 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/