BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Reeza
Super User

@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.

PaigeMiller
Diamond | Level 26

The log provided explains why the variable was not renamed via PROC SORT

--
Paige Miller
Reeza
Super User
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.
PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller
Tom
Super User Tom
Super User

@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.

Reeza
Super User
It does change the name. If you run either my code example or Tom's where he's shown the output, it shows that the RENAME does work, the data set option is applied.
Reeza
Super User

@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. 

SAS Innovate 2025: Register Now

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!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 21 replies
  • 1862 views
  • 0 likes
  • 4 in conversation