BookmarkSubscribeRSS Feed
Jiordani
Calcite | Level 5

Hello, I've been trying to rename all the variables that start with a state, and end with something like  !!Housholds!!Estimate and I keep getting the Error 20-200 saying:

 

"Alphabetic prefixes for enumerated variables (Alabama-Estimate) are different. 

 

Old and new variable name specifications for RENAME must be of the same type. Statement is ignored.

 

 And Error 22-322 says:

 

Syntax error, expecting one of the following: -, :, =.

 

The symbol is not recognized and will be ignored.  

 

I want to change all the variables to a shorted postal abbreviation of the corresponding state. For example I want the variable Alabama!!Housholds!!Estimate to be just AL.  

 

Also, none of my data copied from the first data set to the second dataset, but I created that second dataset. The second dataset just has all of the original variables, but with no observations.  Can I get help getting all my data to be copied over to the new dataset?

 

sas question 1.png

sas question 2.png

This one is the output of the first dataset RegPro.IncoSt  

sas question 3.png

This one is the output of the second dataset RegPro.IncoSt1  

sas question 4.png

1 REPLY 1
PaigeMiller
Diamond | Level 26

Variable name with any characters other than letters, digit or underscore must be represented differently.

 

First, you need 

 

options validvarname=any;

Maybe this has been turned on already, I don't know, it can't hurt to issue that command anyway.

 

Then, for example, you need to enclose such variable names with the unusual characters with quotes and append the letter n on the end, such as

 

'Alabama!!Households!!Estimate'n

Of course, if you spell the name wrong (which you have done), then it still won't work. Proper spelling is required.

 

You might want to request that the person/department providing this data not give the variables such horrible (in my opinion) names.

--
Paige Miller

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 322 views
  • 0 likes
  • 2 in conversation