BookmarkSubscribeRSS Feed
Allaluiah
Quartz | Level 8

Dear SAS Folks, The following part of my existing Retail Datawarehouse SAS script in production throws an error/warning when executed as mentioned below:

%let STORE_ID=%sysfunc(sysget(STORE_ID));

%put &STORE_ID;

LOG Message:

WARNING: An argument to the function SYSGET referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.

The system runs on Unix environment where basically a shell script executes the underlying SAS scripts. I am finding it dificult to understand the concept of operating variable as I read through the documentation for sysget function.

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245954.htm

In the above link, i noticed this point-"If the value of the operating environment variable is truncated or the variable is not defined in the operating environment, SYSGET displays a warning message in the SAS log."

Please kindly advice a fix to my problem.

2 REPLIES 2
Tom
Super User Tom
Super User

Use the built in macro function %SYSGET() instead of trying use %SYSFUNC() to call the data step function SYSGET().

%let store_id=%sysget(STORE_ID);

You could also try using a PIPE to read the output of an echo command, but that would not be operating system independent and requires that PIPE engine access is allowed.

data _null_;

  infile 'echo $STORE_ID' pipe;

  input;

call symputx('store_id',_infile_);

run;

Remember that on Unix environment variable names are case sensitive so STORE_ID is a different variable than store_id.

Allaluiah
Quartz | Level 8

@Tom Thank you, I will try sincerely. Please accept my apologies for the duplication here and in SAS L.

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