Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[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 <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
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
njcoxstata@gmail.com

On Sat, Jun 1, 2013 at 9:15 AM, Mustafa Ornek <ornekmstatalist@gmail.com> 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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index