According to Understanding SAS Indexes
If you rename key variable in SAS, the simple index is renamed instead of being deleted.
However, when I try this on my own, the index file will disappear after I rename the key variable, I wonder what is wrong?
Here is the code that I used:
data work.temp(index=(id));
input id $ amount;
cards;
p 52
p 45
a 13
a 56
r 34
r 12
r 78
;
proc contents data=work.temp;
run;
data WORK.temp ;
set WORK.temp (keep=Id amount rename=(Id=Id_Code));
run;
proc contents data=work.temp;
run;
You can see from the result that after renaming the key variable Id, the index disappears.
Thank you very much!