It worked. Thank you very much!
Arina
---- Original message ----
>Date: Thu, 12 Feb 2009 21:23:34 +0100
>From: [email protected] (on behalf of "Martin Weiss" <[email protected]>)
>Subject: st: Re: encode question
>To: <[email protected]>
>
><>
>Try this with your data, but make backups to guard against any nasty
>surprises along the way. The auto dataset has only one string, so this
>example looks stupid - but isn`t...
>
>*************
>sysuse auto, clear
>qui ds, has(type string)
>foreach var of varlist `r(varlist)'{
>encode `var', gen(`var'new)
>drop `var'
>rename `var'new `var'
>}
>**************
>
>
>HTH
>Martin
>_______________________
>----- Original Message -----
>From: "Arina Viseth" <[email protected]>
>To: <[email protected]>
>Sent: Thursday, February 12, 2009 9:17 PM
>Subject: st: encode question
>
>
>> Dear all,
>>
>> I have a dataset that I imported from Excel using insheet. However, many
>> numerical variables (I have about 200 variables) are now showed as string
>> variables.
>> My question is the following: how can I transform each string variable
>> into numerical one - and also replicate their names - without having to
>> encode manually each one of them?
>>
>> Thank you very much in advance for any help, I would very much appreciate
>> it.
>>
>> Arina
>>
>> *
>> * 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/
>>
>
>*
>* 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/
*
* 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/