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 on April 23, and its replacement, statalist.org is already up and running.


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

RE: st: rename with if


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: rename with if
Date   Fri, 21 Oct 2011 16:29:04 +0100

The -preserve- and -restore- look misplaced now that you draw attention to them. 

levelsof  atc  ,  local(cat) 
preserve 

foreach  k  of local cat {
	use "G:\ATC-dataset_`k'"  ,  clear 
	rename (*) (`k'_*) 
	rename `k'_idnr idnr
	save, replace
}

restore 

Nick 
n.j.cox@durham.ac.uk 

Tomas Lind

YEAS, this solves it! THANKS.

 However I now get another error message  "already preserved".


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index