I am exporting a variable called _call_list from unix to SAS.
In unix ,
export _call_list=${_call_list}
In SAS,
%global call_list;
%let call_list=%SYSGET(_call_list);
%put SEE THE value of call_list is &call_list. ;
In Log:-
MLOGIC(GET_VARS): %LET (variable name is CALL_LIST)
WARNING: The argument to macro function %SYSGET is not defined as a system variable.
I did some research on this error:-
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000543699.htm
my query is how do we define a variable on the operating environment. Any pointers please?
Have you checked existence and value of the environment variable
using echo $_call_list ?
Sorry, your post makes no sense to me. What are you trying to do, get the operating system? If so then use &SYSCP or &SYSCPL:
Reading a flat file in unix. Pick a value from a line from the txt file & pass the value on to SAS program.
Does it make any sense now ?
So you want to batch run a SAS program and pass in some paramters, then you would look at SYSPARM:
This post has some links, and particularly the last post may be helpful.
https://communities.sas.com/t5/SAS-Procedures/SYSPARM-Pass-Command-Line-Arguments-to-SAS/td-p/194511
Note how the %sysget() is used in the code, you can't set a macro variable - which stores it as text - without using some masking features.
I am not a unix expert and do not have access to a unix where I am right now, but try this:
export eval _call_list=${_call_list}
The question is, are you defining the environment variable _call_list in the same or a parent context of the SAS process?
Do you define _call_list in a script that then starts SAS?
I use UNIX environment variables as the sole source of control information for batch runs, and all works well.
The error message is saying that the environment variable doesn't exist. That can either be because you spelled the name wrong or because it really doesn't exist. If your SAS session lets you use pipes you can ask to see all of the environment variables using a simple data step like this.
data _null_;
infile 'env' pipe;
input;
put _infile_;
run;
Your shell command for creating the environment variable looks strange. Your statement is just reassigning the value to itself. Check and make sure you are using syntax that works for your Unix shell. Try something simple like this from the command line to set a value and display it.
export _call_list=ABC
echo $_call_list
Other ways to pass in information include using the -sysparm or -set options on the command that launches SAS. Or just placing the information into a file that the program knows read.
Have you checked existence and value of the environment variable
using echo $_call_list ?
The problem was with the export statement in unix. Thanks for the pointer!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: