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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 999 views
  • 0 likes
  • 4 in conversation