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: changing variable case


From   Ryan Kessler <ryan.kessler.stata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: changing variable case
Date   Wed, 28 Nov 2012 00:35:32 -0500

Hi Mike,

This can be accomplished by nesting the lower function within a foreach loop:

sysuse auto, clear
foreach v of varlist * {
	if substr("`: type `v''",1,3) == "str" replace `v' = lower(`v')
}

Ryan Kessler

On Wed, Nov 28, 2012 at 12:17 AM, Michael Stewart
<michaelstewartresearch@gmail.com> wrote:
> Dear Stat List user ,
>
> I am not sue if my previous post was sent in right fashion.Hence i am
> resending the e-mail.
> I have a large dataset with approximately 600 variables. Some are
> upper case and some are lower case.I  want to convert all of  them to
> lower case. Is there a stata command to convert all variables to lower
> case.I  tried varcase_all  but it toggles between the variable cases.
>
>
> --
> Thank you ,
> Yours Sincerely,
> Mike.
> *
> *   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