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]

SV: st: rename with if


From   Tomas Lind <[email protected]>
To   "[email protected]" <[email protected]>
Subject   SV: st: rename with if
Date   Fri, 21 Oct 2011 15:47:50 +0000

Yeas, the different placement of the -preserve- and -restore-  works to.

Thank you Nick and all others for your input on this. 

/Tomas




-----Ursprungligt meddelande-----
Från: [email protected] [mailto:[email protected]] För Nick Cox
Skickat: den 21 oktober 2011 17:29
Till: '[email protected]'
Ämne: RE: st: rename with if

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 
[email protected] 

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/

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