Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Resolving variable name conflicts when renaming


From   "James Beard" <[email protected]>
To   [email protected]
Subject   Re: st: Resolving variable name conflicts when renaming
Date   Fri, 02 Aug 2013 13:37:43 +0545

Daniel.

Thank you so much. Just what I need!

James.

On 2 Aug 2013 at 9:32, daniel klein wrote:

Your feeling is correct, though it is not an option (or better: an
optional argument) in -strtoname()- but the extended function (-help
extended_fcn-) -permname- creates unique names for variables to be
added.

Here is a simple example

. sysuse auto ,clear
. d mpg
. loc newname : permname mpg
. di "`newname'"

Best
Daniel

-- 
Dear Statalisters,

[...]
But, I don't have control
over what the original column names might be, and it's possible, even
likely, that the last words will be duplicated across columns. I've
written some very mickey mouse code to deal with this by adding 0 to
9 in turn to the names (after reducing the name length to 31
characters if necessary), and checking to see if those names already
exist. [...] I sort-of feel there "ought" to be
an option in -strtoname()- to do this automatically!
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index