BookmarkSubscribeRSS Feed
2 REPLIES 2
PaigeMiller
Diamond | Level 26
proc datasets library=work nolist; /* or if it is not a WORK data set, use the appropriate libname instead of work */
    modify datasetname;
    rename ibesname=company_name;
run; quit;

 

--
Paige Miller
Tom
Super User Tom
Super User

It kind of looks like from that picture that the label has a space in it.  That will not work well as a variable name.  Either it will be invalid, or it you set the VALIDVARNAME option to ANY then it will require that you use a name literal to reference it.  I would suggest either replacing the space with an underscore or using CaMeL case to mark the starts of new words in the name.

 

And to the general case a label can be up to 256 bytes long and a name can only be up to 32 bytes long.  So you cannot always use the label as a name.

 

If you do want to change the name use the RENAME statement (or perhaps the RENAME= dataset option).

If you want to change the label use the LABEL statement.

data want;
  set have;
  rename ibesname=CompanyName ;
  label ibesname='IBES Name' ;
run;

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1901 views
  • 1 like
  • 3 in conversation