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 on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: Batch convert characters in variable labels


From   "Mustafa Ornek" <ornekmstatalist@gmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Batch convert characters in variable labels
Date   Sat, 1 Jun 2013 04:15:26 -0400

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)


I hope it works for you,

Mustafa Ornek
PhD Candidate in Health Policy
McMaster University
Centre for Health Economics and Policy Analysis 
ornekm@mcmaster.ca




-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Haluk Vahaboglu
Sent: June-01-13 1:55 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: Batch convert characters in variable labels

Hello,
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?
Thank
you in advance




Prof. Dr. Haluk Vahaboğlu
Istanbul Medeniyet
Üniversitesi, 
Göztepe Eğitim ve Araştırma Hastanesi
Enfeksiyon Hastalıkları
ve Klinik Mikrobiyoloji ABD
Dr. Erkin Caddesi  34730
Kadıköy / Istanbul  TURKIYE 		 	   		  

*
*   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/


*
*   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