BookmarkSubscribeRSS Feed
veblen
Calcite | Level 5
In doing some ETL development I am finding that SAS isn't allowing me to use some special characters (e.g., parentheses and single quotes) in some places (e.g., file descriptions, file names).

Is there a complete list of non-usable special characters and what/if any escapes there are for their use.

(Please inform me if this is posted in the wrong forum.)

Please let me know if more info is required.

Thanks Thanks, but I have answered this.

Message was edited by: veblen
2 REPLIES 2
Cynthia_sas
Diamond | Level 26
Hi:
SAS file references and file names have strict rules about what a valid SAS name can be. For example, this is a valid column or variable name: AGE_GROUP_1 however 1_AGE_GROUP is an invalid name because it starts with a number and SAS names cannot start with numbers. Valid SAS names can ONLY contain numbers, letters and underscores (spaces not allowed) and must start with a letter or underscore. So this would also be a valid variable or column name: _1_AGE_GROUP.

However, due to the fact that some systems do allow special characters or spaces in a name, for example, SAS also allows you to use "name literals" tokens or strings to reference variables. Some references are:
http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000998953.htm
http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a001392879.htm

For example, as a name literal, it shows in the documentation that you could read in a column or variable with a name of [pre] '$ Amount Budgeted'n or 'Amount Spent'n [/pre] Note that in this syntax construction the whole string is quoted and is immediately followed by an n, which indicates that the string is a name literal.

You might want to open a track with Tech Support for more thorough help on this issue, they can look at all your code and your operating system configuration and make specific recommendations.

cynthia
veblen
Calcite | Level 5
My apologies for the slow response, but THANKS for the assistance Cynthia.

Your advice and the links came in handy and it is highly appreciated.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2 replies
  • 2667 views
  • 0 likes
  • 2 in conversation