Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: option generate() not allowed


From   "Eva Poen" <[email protected]>
To   [email protected]
Subject   Re: st: option generate() not allowed
Date   Thu, 11 Sep 2008 16:45:06 +0100

Fabian,

the user-written command should work for you. I don't have access to
Stata 8, but try this:

***
* generate some test data
clear
set obs 10
gen date = d(1mar1998) + _n
* -tostring- will overwrite the original
gen date1 = date
format date1 %td
list
tostring date1, usedisplayformat
list
descr
***

You could also use

tostring date, format(%td)

I believe. I tried the above with the user-written command (which I
renamed) and Stata 9, and it worked.

Hope this helps,
Eva


2008/9/11 Fabian Brenner <[email protected]>:
> Eva,
>
> thanks for your help. I use version 8.
>
> . which tostring
> *! NJC and JBW 1.2.2 30 March 2000  (STB-57: dm80.1)
> *! NJC 1.2.3 1 August 2000
>
>
> Do you know whether it will work with another version of tostring? Or any other solution..
>
> Thanks a lot!
> Fabian Brenner
>
>
>
> -------- Original-Nachricht --------
>> Datum: Thu, 11 Sep 2008 15:51:23 +0100
>> Von: "Eva Poen" <[email protected]>
>> An: [email protected]
>> Betreff: Re: st: option generate() not allowed
>
>> Fabian,
>>
>> which version of Stata are you using? In Stata 9 and 10, -tostring- is
>> an official command. There exists a user-written command -tostring-
>> which does not allow the generate option (it instead overwrites the
>> existing variable). Check which one you are using, by typing -which
>> tostring- in Stata.
>>
>> Eva
>>
>>
>> 2008/9/11 Fabian Brenner <[email protected]>:
>> > Hello everyone,
>> >
>> > tostring date, generate(date_as_string)
>> >
>> > leads to:
>> >
>> > option generate() not allowed
>> > r(198);
>> >
>> > what is wrong? Thanks in advance!
>> > Fabian Brenner
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index