Bookmark and Share

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 18:49:40 +0000

Thanks Nick, I will consult the technical support and rephrase a single direct question (be more specific), and post it to anyone in the list who might help as you suggested.

Thanks again

________________________________________
From: [email protected] <[email protected]> on behalf of Nick Cox <[email protected]>
Sent: 20 January 2014 18:16
To: [email protected]
Subject: Re: st: issues with tsset based on more than a time variable and duplicates conflicting results

Please don't direct further questions on this as if I will answer
them. I've already suggested that you should let Stata technical
support look at this (and they will want to see you your data). I have
already commented that -egen, group()- is a poor way to get a time
identifier.

Otherwise you seem to be going round and round the same questions and
although I sympathise greatly with your puzzlement I am (as already
said) out of ideas on what is going on.

Naturally, the field is wide open for ideas from anyone else.

Nick
[email protected]


On 20 January 2014 18:11, Abdalla, Ahmed <[email protected]> wrote:
> Nick, to follow up. I tried to play around with it again.
> I have -firmid=group(permno)  and timeid=group(yr mth)
> I have duplicates when I run-duplicates report firmid timeid
> and I have no duplicates when I run -duplicates report permno yr mth
>
> Since I can't -tsset- based on two time variables,i.e. tsset permno yr mth - is incorrect and tsset firmid timeid-doesn't work UNTIL I drop the duplicates on firmid and timeid that don't show up at the same time in duplicates report permno yr mth, I tried the command- tsset permno timeid- i.e. I thought to group only the time variables in one variable and no need to do the same with the panel id variable(permno). Surprisingly, though I don't know if this is correct, it worked properly and no duplicates based on permno timeid.
>
> Is this correct? Can I do that and proceed with the analysis in my panel dat or do I mix things up that way? do you know why this might even happen?
>
>
>
> ________________________________________
> From: [email protected] <[email protected]> on behalf of Nick Cox <[email protected]>
> Sent: 20 January 2014 17:55
> To: [email protected]
> Subject: Re: st: issues with tsset based on more than a time variable and duplicates conflicting results
>
> OK; that rules out that idea. No more ideas from me, sorry.
> Nick
> [email protected]
>
>
> On 20 January 2014 17:47, Abdalla, Ahmed <[email protected]> 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: [email protected] <[email protected]> on behalf of Nick Cox <[email protected]>
>> Sent: 20 January 2014 17:43
>> To: [email protected]
>> 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
>> [email protected]
>>
>>
>> On 20 January 2014 17:38, Abdalla, Ahmed <[email protected]> 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: [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/
>> *
>> *   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index