Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Convert contents of string variables to lower case


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Convert contents of string variables to lower case
Date   Fri, 10 Dec 2004 13:28:42 -0000

ds, has(type string) 
foreach v of varlist `r(varlist)' { 
	replace `v' = lower(`v') 
} 

Nick 
[email protected] 

Dev Vencappa
> 
> Try this
> 
> foreach var of varlist x1 x2 x3...{
> gen Z=lower(``var')
> drop `var'
> rename Z `var'
> }

[email protected] 

> I have a dataset containing numeric and string variables. I'm 
> using foreach 
> to loop across all the variables in my dataset.
> Within this loop, how do I convert the contents of the string 
> variables to 
> lower case?

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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