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

Re: st: Changing variable names

From   Henrik Stovring <>
Subject   Re: st: Changing variable names
Date   Wed, 11 Jun 2008 10:22:45 +0200

Try this (where m is number of variables to rename):

forv i = 1/m {
   local newi = `i' + 55
   rename r`i' r`newi'



Andri Rauch wrote:
Dear all,
I should increase the numbering in my variable names by a certain value (eg 55)
Eg: r1, r2, r3, r4, r5... should read r56, r57, r58, r59, r60...

Hope somebody can help.
Thanks in advance,

-----UrsprŘngliche Nachricht-----
Von: Andri Rauch Gesendet: 26 March 2008 12:12
An: ''
Betreff: Creating single characters from long strings

Dear all,
I should create single characters from very long strings (ie around 500 characters).
My original variable abcdefg... should be transformed to:
variable_1: a, variable_2: b, variable_3: c, variable_4: d and so on...

I assume it should be done by combining the substring and foreach command.

Hope that someone can help,

Thanks in advance

* For searches and help try:

Henrik St°vring, PhD

Research Unit for General Practice
University of Southern Denmark J.B. Winsl°ws Vej 9A
DK-5000 Odense C
Phone: (+45) 6550 3692
Fax: (+45) 6591 8296 email:

* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index