Last active
August 11, 2020 15:46
-
-
Save statgeek/ba360dd1cf748bf6d0da7e2e16aafe66 to your computer and use it in GitHub Desktop.
SAS Rename - proc datasets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*This code illustrates how to rename data sets dynamically*/ | |
data _new_list; | |
set sashelp.vtable | |
(where=(upcase(libname)='WORK')) end=eof; | |
*filter list for only tables of interest; | |
*start proc datasets; | |
if _n_=1 then | |
call execute ('proc datasets lib=WORK nodetails nolist; change'); | |
*add on new name calculation; | |
new_name=catt('Name', put(_n_, z3.)); | |
*pass new and old name to proc datasets; | |
call execute (memname); | |
call execute ('='); | |
call execute (new_name); | |
*if last record then quit; | |
If eof then | |
call execute (';run;quit;'); | |
run; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment