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: RE: RE: Batch convert characters in variable labels
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: RE: RE: Batch convert characters in variable labels
Date
Sat, 1 Jun 2013 09:57:51 +0100
Haluk is using Stata 12.
Rather than learning a new old program -renvars-, it is better for
Haluk to learn a newer new command. See -help rename groups-.
For about a decade, -renvars- (SJ) was a way to do multiple -rename-s
that -rename- did not support directly, but the new -rename- is vastly
more versatile than the old.
By the way, -renvars- offers no tricks of supporting special
characters that can not be achieved through -rename-. I don't know how
far Haluk's problem is soluble and I am not in a position to
experiment.
Nick
[email protected]
On Sat, Jun 1, 2013 at 9:15 AM, Mustafa Ornek <[email protected]> wrote:
> I believe you can benefit from a package called "renvars".
> You can install within Stata by typing: net search renvars
>
> This package has a variety of options to let you rename variables.
>
> Eg;
> /* With the following loop we are adding those variables
> starting with letters "a-k" numbers "1-11"*/
> ****
> local s=1
>
>
> foreach let in a b c d e f g h i j k {
>
> renvars `let'* , postfix(`s')
> local s=`s'+1
> }
>
> /* The following code renames EVERY variable in the
> dataset in a way that they drop the first character in
> their names*/
>
> renvars *, predrop(1)
Haluk Vahaboglu
> I am using Stata 12 during my clinical research activities. In my country
> (Turkiye) we work with databases encoded according to Codetable ISO/IEC
> 8859-9.
> When I import data from an excel workbook, naturally variable names omit
> special characters (Ğ, İ, Ş, ğ, ı, ş) which are considerably common in
> Turkish. Since lots of characters ommitted in variable names these become
> puzzling to work.
> However, I see these characters in variable labels.
> If I may be able to change characters in variable labels and assign these
> converted labels as variable names it would work for me.
> Could anyone help me to batch convert special characters in variable labels
> and assign these converted labels as variable names?
*
* 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/