BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GunnerEP
Obsidian | Level 7

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

Have you checked existence and value of the environment variable

using echo $_call_list  ?

 

 

View solution in original post

8 REPLIES 8
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

GunnerEP
Obsidian | Level 7

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 ?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.  

MichaelLarsen
SAS Employee

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}

 

Kurt_Bremser
Super User

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.

Tom
Super User Tom
Super User

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.

 

Shmuel
Garnet | Level 18

Have you checked existence and value of the environment variable

using echo $_call_list  ?

 

 

GunnerEP
Obsidian | Level 7

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 8 replies
  • 9899 views
  • 0 likes
  • 6 in conversation