Statalist


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

AW: st: changing the variable name form capital letters to small letters.


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: st: changing the variable name form capital letters to small letters.
Date   Fri, 27 Nov 2009 09:14:25 +0100

<> 

-replace- would change the values of the variable, not its name. If Rajaram
does not want to use -renvars-, as suggested by Richard, he can of course
say


*************
foreach var of varlist _all{
	rename `var' `=lower("`var'")'
}
*************



" some of them are numeric and some are string variables."

The storage type of the variables should have no bearing on this operation,
as all you want to change is the name, not the values. If ever you wanted to
condition on the type, use -ds-, as in my
http://www.stata-journal.com/article.html?article=dm0040



HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von [email protected]
Gesendet: Freitag, 27. November 2009 07:53
An: statalist
Betreff: Re: st: changing the variable name form capital letters to small
letters.

Suppose the variable is named x,  try "replace x=lower(x)".


Hope it helps.

Best regards,
Rose

----- Original Message -----
From: Rajaram Subramanian Potty <[email protected]>
To: [email protected]
Subject: st: changing the variable name form capital letters to small
letters.
Date: 2009-11-27 13:22:39

Dear All,
Is there any way I can change the name of the variable. In my data set
the variables are in capital letters and I want them to change into
small letters. There are about 700 variables and I wanted to change
them into small letters. The list of some of the variables in my data
set is given below, some of them are numeric and some are string
variables.

S1Q1 wanted to change to s1q1
S1Q2 change to s1q2
S1Q3 change to s1q3
S1Q4 change to s1q4 etc.
S1Q5
S1Q6
S1Q7
S1Q8
S1Q9
S1Q10
S1Q11
S1Q12
S1Q13
S1Q14
S1Q15
S1Q16
S1Q17
S1Q18
S2Q1
S2Q2
S2Q3
S2Q4
S2Q5
S2Q6
S2Q7
S2Q8
S3Q1
S3Q2
S3Q2CASTE change to s3q2caste
S3Q3
S3Q3OTHER
S3Q4
S3Q5
S3Q6
S3Q6OTHER
S3Q7
S3Q8
S3Q8A
S3Q9
S3Q9DURATION
S3Q10
S3Q10DURATION
S3Q11
S3Q11ILLNESS

Thanks and regards,

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



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