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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 869 views
  • 0 likes
  • 4 in conversation