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;

 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

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
  • 1583 views
  • 1 like
  • 3 in conversation