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. 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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