@Tom wrote:
I really doubt that RENAME= option is not working for you. You are either looking at the wrong dataset or not looking at the NAME of the variable.
Please show the proc contents for the dataset newresults2.
Agreed.
The log provided explains why the variable was not renamed via PROC SORT
@Reeza wrote:
It doesn't indicate any issue with renaming as far as I can see, it says the data set is not sorted but it also says the second data set is created and that shows the rename correctly. I could be missing something but I think both Tom and my example show the code is valid and correct.
The log said:
"NOTE: Input data set is already sorted; it has been copied to the output data set."
When you make a copy, the variable names are not changed.
@PaigeMiller wrote:
@Reeza wrote:
It doesn't indicate any issue with renaming as far as I can see, it says the data set is not sorted but it also says the second data set is created and that shows the rename correctly. I could be missing something but I think both Tom and my example show the code is valid and correct.The log said:
"NOTE: Input data set is already sorted; it has been copied to the output data set."
When you make a copy, the variable names are not changed.
Prove it show an example where the dataset options to rename the variables don't happen. Show the before and after proc contents. Just because to PROC SORT all it did was copy the data it does not mean that SAS didn't apply the dataset options. PROC SORT doesn't even know there were dataset options being applied.
@monsterpie wrote:
ok,so I ran this on a different set of data but even in this data the variable is not renamed in the new dataset.
Proc transpose data=shortdiag
out=newresults2 (rename=(hdghraencwid=hraencwid))
prefix=diag;
by hdgHraEncWid;
var diagnosis;
run;
Show the log.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.