Renaming a dataset within the XPORT library is not possible, because of the internal sequential structure of the XPORT file.
You need to recreate the whole file:
/* create the xpt file for testing */
libname xp xport '/folders/myfolders/class.xpt';
proc copy in=sashelp out=xp;
select class air;
run;
libname xp clear;
/* how to rename a dataset */
/* assign xport library */
libname xp xport '/folders/myfolders/class.xpt';
/* create a temporary library within the WORK path */
%let wk = %sysfunc(pathname(WORK));
%let rc = %sysfunc(dcreate(temp,&wk.));
libname scratch "&wk./temp";
/* copy the contents there */
proc copy in=xp out=scratch;
run;
/* rename the dataset */
proc datasets lib=scratch nolist;
change class=class1;
quit;
/* move it back to the xport library */
proc copy in=scratch out=xp;
run;
/* deassign */
libname xp clear;
/* remove the scratch library */
/* empty it */
proc datasets library=scratch kill nolist;
quit;
libname scratch clear;
/* remove the directory */
%let rc=%sysfunc(filename(dref,&wk./temp));
%let rc=%sysfunc(fdelete(&dref.));
... View more