Solved
Contributor
Posts: 32

# WARNING: The argument to macro function %SYSGET is not defined as a system variable.

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?

Accepted Solutions
Solution
‎02-07-2017 11:39 AM
Posts: 1,394

## Re: WARNING: The argument to macro function %SYSGET is not defined as a system variable.

Have you checked existence and value of the environment variable

using echo \$_call_list  ?

All Replies
Super User
Posts: 7,407

## Re: WARNING: The argument to macro function %SYSGET is not defined as a system variable.

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:

https://v8doc.sas.com/sashtml/macro/z1071968.htm

Contributor
Posts: 32

## Re: WARNING: The argument to macro function %SYSGET is not defined as a system variable.

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 ?

Super User
Posts: 7,407

## Re: WARNING: The argument to macro function %SYSGET is not defined as a system variable.

So you want to batch run a SAS program and pass in some paramters, then you would look at SYSPARM:

http://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#n0u0t8c3b3syeen1l1...

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.

SAS Employee
Posts: 20

## Re: WARNING: The argument to macro function %SYSGET is not defined as a system variable.

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}

Super User
Posts: 6,947

## Re: WARNING: The argument to macro function %SYSGET is not defined as a system variable.

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Posts: 6,502

## Re: WARNING: The argument to macro function %SYSGET is not defined as a system variable.

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.

Solution
‎02-07-2017 11:39 AM
Posts: 1,394

## Re: WARNING: The argument to macro function %SYSGET is not defined as a system variable.

Have you checked existence and value of the environment variable

using echo \$_call_list  ?

Contributor
Posts: 32

## Re: WARNING: The argument to macro function %SYSGET is not defined as a system variable.

The problem was with the export statement in unix. Thanks for the pointer!

☑ This topic is SOLVED.