SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
ayosas
Fluorite | Level 6

the variable has a space in it, I checked using proc contents and both the label and var name have a space in them. I tried renaming using the rename option

 

this is the error I get 

 

77 rename education level = education_level;
ERROR: Alphabetic prefixes for enumerated variables (education-level) are different.
ERROR: Old and new variable name specifications for RENAME must be of the same type. Statement is ignored.
ERROR 79-322: Expecting a -.
5 REPLIES 5
PaigeMiller
Diamond | Level 26

You need

 

options validvarname=any;

and then you can rename with

 

rename 'education level'n = education_level;

notice the quotes and the letter n after the final quote

--
Paige Miller
ayosas
Fluorite | Level 6

So if this is an excel file, this option should go before proc import?

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 5 replies
  • 3479 views
  • 3 likes
  • 3 in conversation