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: Tsset date


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Tsset date
Date   Mon, 21 Jan 2013 11:41:27 +0000

So, I previously covered your problem and in any case Stata has now
answered your question. You must convert your date variable to a
numeric variable using the -date()- function for it to be acceptable
to -tsset-.

Two concurrent threads talk about this too.

Also, do read the Statalist FAQ on advice on formatting posts, as you
were asked to do when you joined the list.

Nick

On Mon, Jan 21, 2013 at 11:31 AM, Terence Fung <[email protected]> wrote:
> Hi Nick,
> I did try to provide the error message. The email bounced back every time. Format issue.
>
> Describe s date
> Gives storage types are byte and str6, respectively.
>
> tsset s date
> Gives varlist: date: string variable not allowed.
>
> Thanks
>
> Sent from my iPad mini
>
> On 21 Jan, 2013, at 5:24 AM, "Nick Cox" <[email protected]> wrote:
>
>> In general, it is not a good idea to expect an explanation of an error
>> message when you don't even tell us what the error message is.
>>
>> Stata daily date variables must be _numeric_ to be acceptable to
>> -tsset-. No Stata numeric variable can have a value that is "1960Q1".
>> However, applying the format %tq to a numeric variable would result in
>> displays such as "1960q1".
>>
>> If you literally typed "Tsset s date", that would be an error, as the
>> command is -tsset-.
>>
>> I suggest that you show us the results of
>>
>> describe s date
>> tsset s date
>>
>> meaning that you copy exactly what Stata types in the Results window
>> when given these two commands.
>>
>> Nick
>>
>> On Mon, Jan 21, 2013 at 9:48 AM, Terence Fung <[email protected]> wrote:
>>
>>> Suppose a variable named 'date' has value = '1960Q1', the panel unit is named 's' whose value =1. I tried: format date %tq
>>> Tsset s date
>>> How come an error message pops up? I'm using stata 10.
*
*   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