BookmarkSubscribeRSS Feed
SASPhile
Quartz | Level 8
In order to allow sas to use blanks and special characters in the variable name without causing errors, the follwoing piece of code is used.
%LET VGROUP&I = "&&GROUP&I"N;

for instance &&group&I resolves to Cozar 24 FE, and then in subsequent step Vgroup&1 is transformed to a variable. In PC SAS it throws an error due to spacing issue.This is not the case when SAS is run on Mainframe.
If I have to run this on PC sas this is giving me an error.How to resolve this?
3 REPLIES 3
chang_y_chung_hotmail_com
Obsidian | Level 7
I'd first check the validvarname option setting. You can simply call proc options or submit the following line:



   %put validvarname=%sysfunc(getoption(validvarname));

Tim_SAS
Barite | Level 11
Make sure you're using the VALIDVARNAME=ANY option.


"Note: If you use any characters other than the ones that are valid when the VALIDVARNAME system option is set to V7 (letters of the Latin alphabet, numerals, or underscores), then you must express the variable name as a name literal and you must set VALIDVARNAME=ANY."


See Rules for SAS Variable Names.
Ksharp
Super User
Hi.
In addition to Tim@SAS.

options validvarname=any;

is only suited for sas/base and sas/stat


Ksharp

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 1069 views
  • 0 likes
  • 4 in conversation