# RE: st: RE: problem levpet command

 From "Nick Cox" To Subject RE: st: RE: problem levpet command Date Thu, 11 Dec 2008 19:13:30 -0000

```The code does not change the picture. Basically, the program works out
the smallest difference between sorted times within each panel. If it's
zero, it concludes that you have "Repeated time values within panel", as
you know already. On the face of it, that's reasonable.

I do note your earlier report about using -duplicates-, which makes it
seem especially puzzling.

There have been instances of people saying "But it's not true" and in
turns out that it really is. See the FAQ:

FAQ     . . . . . .  Dealing with reports of repeated time values within
panel
. . . . . . . . . . . . . . . . . . . . . . . N. J. Cox and M.
Mulcahy
12/05   How do I deal with a report of repeated time values
within panel?
http://www.stata.com/support/faqs/data/repeatedtime.html

Nick
n.j.cox@durham.ac.uk

pim de Nijs

. set tr on

Then I got a whole list. I will copy the part where it goes wrong:

- sort `panel' `timevar'
= sort __000003 Year
- if "`panel'" != "" {
= if "__000003" != "" {
- local bypfx "by `panel': "
= local bypfx "by __000003: "
- }
- tempvar timedif
- qui `bypfx' gen long `timedif' = `timevar'[_n+1] - `timevar'
= qui by __000003:  gen long __000004 = Year[_n+1] - Year
- qui sum `timedif', meanonly
= qui sum __000004, meanonly
- if r(min) == 0 {
- if "`panel'" != "" {
= if "__000003" != "" {
- di in red "repeated time values within panel"
repeated time values within panel
- }
- else di in red "repeated time values in sample"
- exit 451

My knowledge about Stata is limited so I do not know what all these

> From: martin.weiss1@gmx.de

> As always in such situations, -set tr on- and see where the thing gets
stuck
> (or let the list know)...

pim de Nijs

> My knowledge about Stata is limited and a feel ashamed that i have to
bother
> you with my question because maybe I just made a stupid mistake in the
> command that I use. But I really do not know how I can solve the
problem and
> I could not find a solution on the internet.
>
> I want to use the following command:
>
> . levpet logSales, free(logEmployees) proxy(logMaterials)
> capital(logCapital) i(number) t(Year) revenue
>
> I get the following error:
>
> repeated time values within panel
> r(451);
>
> I have no idea why i get the ''repeated time values within panel''
error. I
> am 100% sure that there are no duplicates:
>
> . dupliactes list Year number
>
> result: no observations are duplicates
>
> By only using a part of my dataset i get an idea what the problem is:
>
> . levpet logSales if (NACE<=1531), free(logEmployees)
proxy(logMaterials)
> capital(logCapital) i(number) t(Year) revenue
>
> Now I get the results of the levpet command. However there is
something
> strange:
>
>
> Dependent variable represents revenue. Number of obs = 148
> Group variable (i): number Number of groups = 5756
> Time variable (t): Year
> Obs per group: min = 1
> avg = 4.1
> max = 5
>
>
> The number of observations is 148 and the number of groups is 5756?
Then I
> see that the average number of observations per group is 4.1 This
means that
> the number of groups should be 36 and not 5756.
>
> I really have know idea what is going wrong. I just like to get the
levpet
> results for my whole dataset. The . help levpet command do not give me
the
> answer. Others papers that I have read and that are using the levpet
command
> are telling that it is straightforward to use the levpet command.

*
*   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/
```