Statalist


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

Re: st: generating new variables: any shortcut?


From   "Vladimir V. Dashkeyev" <[email protected]>
To   [email protected]
Subject   Re: st: generating new variables: any shortcut?
Date   Tue, 10 Jul 2007 16:45:14 +0400

Dear Maarten, Sebastian, and Rodrigo,

Thank you for the valuable advice! I tried all the variants and they
worked fine.

Thanks again,
Vladimir.

On 7/10/07, Rodrigo A. Alfaro <[email protected]> wrote:
There is a user-ado called -takelogs- that
adds the prefix "l" to the new variables.

findit takelogs
help takelogs

Rodrigo.

----- Original Message -----
From: "Sebastian F. Büchte" <[email protected]>
To: <[email protected]>
Sent: Tuesday, July 10, 2007 5:21 AM
Subject: Re: st: generating new variables: any shortcut?


> You could try -foreach-:
>
> foreach elem of varlist var1-var15 {
>      gen log_`elem' = log(`elem')
> }
>
> hth
> Sebastian
>
> On 7/10/07, Vladimir V. Dashkeyev <[email protected]> wrote:
>> Dear all,
>>
>> I want to create new variables by taking logarithms of old variables
>> and I want to keep old names:
>>
>> -- gen log_var1 = log(var1) --
>>
>> If I need to take logs of all the variables in the dataset or at least
>> of the variables that are named consequently (e.g. var1,
>> var2...var15), is there a way to generate new variables by a single
>> command?
>>
>> Thanks in advance,
>> Vladimir.
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/support/faqs/res/findit.html
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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