You need to use the n literal notation, quotes and an N after the quotes to indicate this is a name literal and refers to either a variable or data set name. SAS does not allow varialbes to be named with numbers at the start (common in programming languages) and then you need to use this type of notation to get around that limitation. In general, I recommend renaming the variables to Total2017_65_80P. Prefixes are definitely more supported in SAS than suffixes.
Keep States '2013_Total_65_80'n;
If you set the validvarname=V9 it will automatically rename variables when you import them, usually by adding an underscore at the start.
@Essen5605 wrote:
I have a large data set with a bunch of variables that start with example 2017_Total_65_80P. I am trying to find a way how to use the variable to perform manipulations by not changing the variable name to something like Total_65_80P_2017 since SAS prefers text followed by digit.
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
24
25 GOPTIONS ACCESSIBLE;
26 data work.CPS_CENSUS_65Plus;
27 set MYLIB.CPS_CENSUS;
28 keep States '2013_Total_65_80';
__________________
22
200
ERROR 22-322: Syntax error, expecting one of the following: a name, -, :, ;, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.
ERROR 200-322: The symbol is not recognized and will be ignored.