- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 02-17-2022 12:32 PM
(3478 views)
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
For non-standard names, you have to use name literals:
rename 'education level'n = education_level;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
PS you can avoid this by issuing
options validvarname = v7;
before importing the data into SAS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
So if this is an excel file, this option should go before proc import?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes. SAS will then convert the names to valid SAS names by replacing invalid characters with underlines.