I have column name as age_10+, how would I rename that var in sas as it's already been imported via teradata connection. Any help is really appreciated .
You need to use a name literal:
rename 'age_10+'n=age_10_p;
Did the "import" already run successfully? What is the name used for the variable in the resulting SAS dataset. Use PROC CONTENTS or other way of looking at the actual name. Don't just look at what you see in some viewer or PROC output as that might be displaying the label.
If you have the SAS option VALIDVARNAME set to ANY then you can use a Name Literal to reference that goofy name. So if your SAS dataset is named WORK.MYDATA then you could rename the variable this way.
proc datasets lib=WORK nolist;
modify MYDATA ;
rename 'age_10+'n=age_10plus ;
run;
quit;
If you have VALIDVARNAME=V7 then the name was probably already fixed by replacing invalid bytes with underscores. So most likely it is named AGE_10_
VALIDVARNAME is only relevant when importing data into SAS. Once your non-standard variable names are in SAS then you have to reference them as name literals as already explained.
29 rename AGE_85_+_PCT=age_85_plus;
ERROR: Missing numeric suffix on a numbered variable list (AGE_85_-_PCT).
This code is not what was provided to you as a solution.
You have to enclose the variable name inside ' 'n as shown.
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 25. Read more here about why you should contribute and what is in it for you!
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.