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, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: working with panel data in Stata


From   olorunfemi sola <solafem7@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: working with panel data in Stata
Date   Sat, 17 Mar 2012 09:03:04 +0000 (GMT)

Dear All,

Am working with panel data. The data are as follows:
id    time    ep    dep    lr
lagos    2000    10    11    12
lagos    2001    8    12    13
lagos    2002    9    9    9
lagos    2003    7    10    12
ondo    2000    10    8    10
ondo    2001    8    12    13
ondo    2002    10    11    14
ondo    2003    7    10    11
ife    2000    9    11    12
ife    2001    8    8    11
ife    2002    9    10    12
ife    2003    10    9    12
But when i give this command --------" tsset id time " it gave the following error:
  tsset id time
varlist:  id:  string variable not allowed
r(109)
Expecting your assistance.


*********************************************************************** 
SOLA OLORUNFEMI   Ph.D
SENIOR LECTURER  
 DEAPARTMENT OF ECONOMICS
ADEKUNLE AJASIN UNIVERSITY 
AKUNGBA AKOKO 
ONDO STATE NIGERIA 
official e-mail: olorunfemi@adekunleajasinuniversity.edu.ng
TEL NO +234 803 581 0893 

**********************************************************************


________________________________
From: Nick Cox <njcoxstata@gmail.com>
To: statalist@hsphsun2.harvard.edu 
Sent: Friday, 16 March 2012, 23:46
Subject: Re: st: Confirming whether a variable is binary or continuous

My wording was sloppy. That test is satisfied also by one distinct
value. For there to be precisely two distinct values, it is also
necessary for -var[1]- to differ from -var[_N]-.

Similarly the test -inlist(var, 0, 1)- is satisfied if -var- is always
0 or if -var- is always 1.

Nick

On Sat, Mar 17, 2012 at 7:05 AM, Nick Cox <njcoxstata@gmail.com> wrote:
> Variations on this are often used inside Stata commands
>
> sort var
> assert var == var[1] | var == var[_N]
>
> Here -var- must be one of two distinct values, but nothing specifies
> what they are precisely.
>
> Nick
>
> On Fri, Mar 16, 2012 at 11:39 PM, daniel klein
> <klein.daniel.81@googlemail.com> wrote:
>> Nick,
>>
>> very smart solution, thanks. Seems it is often the simple solutions
>> that are so hard to find.
>>
>> The difference to the "-tabulate- solution" is that <var> is allowed
>> to be a constant here, which is perfectly alright for a binary
>> variable. It is for Bert to decide whether the indicators are allowed
>> to be constant or have to vary.
>>
>> Daniel
>>
>> --
>> You can also do this by e.g.
>>
>> assert inlist(var, 0. 1)
*
*   For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/statalist/faqhttp://www.ats.ucla.edu/stat/stata/

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


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