Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Michael Stewart <michaelstewartresearch@gmail.com> |
To | statalist <statalist@hsphsun2.harvard.edu> |
Subject | st: Need help using global macros |
Date | Sun, 17 Nov 2013 08:37:46 -0500 |
Hi , I am trying to use global macro, set up an output folder to save files after data management . However,after data management, I am not able to store the files as names similar to their original names. My code is as follows. ************Code Start********************** clear macro drop _all global output "Y\Data" local x "Z\Data\file_summer_1" local y "Z\Data2\file_winter_1" local all x y foreach z in `all'{ use ``z'',clear data management step . data management step save "$output\``z''_new.dta",replace } ************Code Ends********************* Problem : I am not able to store the files after data management in the output folder as "file_summer_1_new" and "file_winter_1".The files are being stored as "x_new" and "y_new". Can you please help . Thank you very much for your time and effort. -- 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/