how to proceed with Renaming the label as same as variable name?

Accepted Solution Solved
Reply
Contributor
Posts: 20
Accepted Solution

how to proceed with Renaming the label as same as variable name?

I have this case where I want to rename the label as same as variable name, for example

I have the variable name 'Fundplatinum' however label shows as 'fnd pltnm' ( Previously from the raw file after importing I had renamed only the variable and not the label )

How to go ahead about renaming the label now?

I am aware of renaming the label and variable at the same time, like this

data SS_2014_V4;

set SS_2014_V3;

label SKL = 'SplKlLoun';

rename SKL = SplKLoun;

run;

But not aware of renaming label only, can we use proc dataset?

I understand that label names doesn't make any difference but want to know how to rename label only ?

Thanks

Prash


Accepted Solutions
Solution
‎07-15-2015 08:28 AM
Super User
Posts: 7,405

Re: how to proceed with Renaming the label as same as variable name?

Use PROC SQL with the ALTER TABLE and MODIFY statements: Base SAS(R) 9.2 Procedures Guide

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Solution
‎07-15-2015 08:28 AM
Super User
Posts: 7,405

Re: how to proceed with Renaming the label as same as variable name?

Use PROC SQL with the ALTER TABLE and MODIFY statements: Base SAS(R) 9.2 Procedures Guide

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Posts: 9,865

Re: how to proceed with Renaming the label as same as variable name?

A good way is removing these LABELs.

Code: Program

data SS_2014_V4;

label SKL = 'SplKlLoun';
SKL = 1;
run;
proc datasets library=work nodetails nolist;
modify SS_2014_V4;
  attrib _all_ label=" ";
quit;

Super User
Super User
Posts: 6,842

Re: how to proceed with Renaming the label as same as variable name?

The LABEL statement attaches the label to the variable.  It is not really the same thing as renaming a variable.

If you set the label to blank then in most places SAS will just use the variable name.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 2046 views
  • 8 likes
  • 4 in conversation