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

According to the official SAS documentation, SAS can be started in 4 different modes:

1. Windows Environment Mode

2. Interactive Mode

3. Batch Mode

4. Noninteractive Mode

(Note that I am only talking about SAS 9.4 Foundation without any extensions like SAS/Connect or SAS/Assist etc)

These 4 modes to run SAS are clearly stated here:

Link1: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/basess/n0m73k6z00uxp6n11imjuvxkaml4.htm

Note that in this chapter, there are different sub-chapters for 'batch mode' and 'noninteractive mode'.

This clearly implies that these are TWO DIFFERENT ways to run SAS.

 

Problem is, I only know of three SAS modes, which are the following (I am talking about Unix as the Host System for the SAS Installation)

1)

sas -dms

Submitting this command in a shell invokes SAS in Windows Environment Mode. No questions here. I know what happens.

2)

sas -nodms

This invokes SAS in Interactive Mode. No questions here.I know what happens after submitting this command in a shell.

3)

sas myprg.sas     or
sas myprg.sas & (background processing)

According to some other chapters of the offical SAS- doc, this is the batch mode, see this link

Link 2:

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/n0x9esc5c95qg4n1wogx5u2k7354.htm

Note that it doesn't matter whether the command is typed manually or scheduled by crontab, it is called batch mode

in both cases.

 

So the remaining question is: what EXACTLY is the 4th remaining mode (noninteractive mode) and how exactly do i start it in SAS under unix?

Then again, SAS itself provides contradictory information. According to this chapter

Link 3:

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/n0x9esc5c95qg4n1wogx5u2k7354.htm

there is NO DISTINCTION

made between bash mode and noninteractive mode, in fact neither of them are listed, but instead there is a mode

listed called "Non-interactive batch mode".  So this could imply, there are in fact no 4 modes, but 3:

Windowing Env. Mode, Interactive Mode and Batch Mode (which by nature is non-interactive).

 

But then again, in a 4th chapter about all these modes, batch mode and noninteractive mode are

documented as different modes again:

Link 4:

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/basess/p1kxww6uew143an1rbqyopwl0bgx.htm

 

This doesn't make sense to me. The only explanation is that Link 3 refers specifically to SAS under Unix,

so maybe under unix there are only 3 modes, but on different OS, there are 4 modes?

 

Can anybody enlighten me? What is the difference, if any, between bash mode and noninteractive mode?

And how exactly do you start them in Unix? Please be specific, the explanations in the docs are too vague

and 80% the same for bash mode and noninteractive mode.

 

Thanks!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

I think the problem is the attempt make some distinction between a "batch" mode and a "non-interactive" mode. 

 

As is normal with computer terminology existing words are adopted and attached to very specific concepts that have only a passing relationship with the ordinary meaning of those words.

 

BATCH is a pretty well defined concept in computers (at least to us old timers) and is not the same as just running a program.  Just running a program at the terminal is not batch.  I don't call it "batch" if I run a compiler. 

 

When I ran SAS from the REXX text editor on a VM/CMS machine I was not running a "batch" job.  The editor script would save the program file and use SAS to run the program.  That was a "non-interactive" run if you will.  So are those that use similar scripts in EMACS to do the same thing on UNIX systems. 

 

If you have a JOB card you are submitting a batch job.  Tools like LSF are using batch queues to run jobs. 

 

When I ran SAS from the WYLBER editor on a MVS system in the 1980's the files I submitted to run had JOB cards are were sent to be batch run.  That was running in batch.

View solution in original post

25 REPLIES 25
Tom
Super User Tom
Super User

I suspect that they are trying to distinguish between a running mode where your "terminal" is tied up waiting for the SAS job to finish ("non interactive") and where it is not ("batch").  In Unix you could essentially make this difference by appending the & symbol to the end of the command line.  What the difference would be in Windows or CMS or TSO I am not sure. 

 

If you really want to run "batch" then leave your card deck at the communications window and the operator will run it through the machine and return your card deck with your printout to the output bin.

Quentin
Super User

I've never heard of Noninteractive mode.  I wonder if it's only a z/OS thing.  I checked SAS Companion for Windows, and SAS Companion for Unix, and couldn't find a reference to it.  But it is mentioned a few times in SAS Companion for z/OS, e.g. https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hosto390/p0m1fwogu1px51n16i7cfy7zugzk.htm .

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.
SASKiwi
PROC Star

My take is that non-interactive mode and immediately-running batch mode without Unix & are pretty much synonymous. I do remember back in the day of being able run SAS programs in a file list / editor screen by typing "run" or "ex' etc as opposed to a command line. This was in CMS.

mike_bn
Obsidian | Level 7

Thanks to all of you.

I also feel that maybe a clear distinction between non-interactive mode and batch mode only exists in z/OS (which I don't know at all). As one of you said, 'non-interactive mode' is only mentioned in the general doc and in the companion for z/OS and not for unix/windows. I feel that in Unix, there is only batch mode, which is always non-interactive, in my opinion. Like one of you said, one could argue that if you submit the command in a terminal without & it is even 'more' non-interactive, because you cannot do anything at all, while with & you can continue working doing other stuff. But imo, the term 'non-interactive' refers to SAS, and not the terminal, and  (in most cases) one cannot interact with the SAS-session you started with 'sas xxx.sas', no matter whether you used & or not. So I feel there is only one mode in Unix, which can be called 'non-interactive batch mode' and this is the exact term that is used in one chapter (see one of my links in my first post).

Quentin
Super User

 


@mike_bn wrote:

So I feel there is only one mode in Unix, which can be called 'non-interactive batch mode' and this is the exact term that is used in one chapter (see one of my links in my first post).



Unix does offer an interactive mode, similar to interactive mode on Windows.  See https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/n100yzpgdlgqtjn17rrkpzoop542.htm.  I think most folks consider SAS having two modes: interactive and batch.  But there are some grey areas.

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.
mike_bn
Obsidian | Level 7

Of course I am fully aware of the addtional modes 'interactive mode' and 'window environment mode' in unix. I listed them both in my first post for completeness sake. When I wrote  just one mode (in Unix), I meant that bash mode and

noninteractive mode are the same (in unix) and not two different modes and for that reason the doc sometimes call

it 'noninteractive bash mode' (again: just talking about unix, on other OS (z/OS), there might be a difference between

noninteractive mode and bash mode as in some parts the doc differentiates between these modes)

Tom
Super User Tom
Super User

Batch is not really a good name for the normal non-display manager mode of running on Unix.  In Unix I would call such a process a background process, it is running as a child of your process, but not interacting with your current terminal with stdin and stdout. 

 

I would reserve "batch" for when you actually submit the job via CRON or some other scheduling tool like LSF. 

 

Note that even if you run a process in background it can still use AF or simple WINDOW statement to pop open a X window and interact with you. 

 

Perhaps if you are running a SAS process in the background with the -noterminal option then perhaps that is more non-interactive.  

 

Or if you run with the -stdio option so that it takes commands from the stdin and writes the  log and listing output to stdout and stderr then perhaps you could call that non-interactive?

mike_bn
Obsidian | Level 7

Hi Tom,

thank for your patience and the replies. Before I started reading the SAS doc, my (rough) understanding of what

a batch job is was similar to yours and I think many share this understanding. Unlike SAS it seems, I quote from this link:

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/n0x9esc5c95qg4n1wogx5u2k7354.htm

 

"To run SAS in batch mode, you specify your SAS program name in the SAS invocation command. You can run batch mode in the foreground, in the background by specifying an ampersand at the end of the SAS command, or submit your application to the batch queue by using the batch, at, nohup, or cron UNIX commands. (For more information, see the UNIX man pages for the batch, at, nohup, or cron commands.) If you start your application with one of these UNIX commands and you log off from your system, then your application completes execution. If your application contains statements that start an interactive procedure such as FSEDIT, then you need to run your batch application in the foreground or you need to specify the –noterminal option."

and, in addition, for 'invoking SAS in batch mode' they provide this example

' you would enter the following command'

sas weekly.sas -nodate -linesize 90

'The command would run the program in the foreground. If you want to run the program in the background, add the ampersand to the end of the command'

sas weekly.sas -nodate -linesize 90 &

So, for them, it is also batch mode. I am still inclined to agree with you and NOT call this batch mode,

when I submit this command after logging in with some terminal emulator to the unix machine and typing this commands and hitting enter.

 

What do you think about this understanding/definition:

1) 

sas noninteract.sas  

entered in the shell (after logging to the unix machine with some terminal emulator like SecureCRT)

-> This starts SAS in non-interactive mode (lets assume noninteract.sas has no statements that require user input)

2)

sas noninteract.sas & 

Same as 1) , so also non-interactive mode, with the only difference that because of the &, the process runs in the

background

 

3) I have a shellskript  noninteract.sh with just one command in it which is

sas noninteract.sas  

And noninteract.sh is scheduled by crontab (or any other scheduler)

-> SAS runs as a batch job (and is non-interactive - which typically is the case for any batch job)

 

 

 

 

 

 

Quentin
Super User

As SAS is run on many operating systems, and many clients, I don't think the definition of interactive vs batch should vary by operation system.

 

Maybe it's because I started on Windows, but I like the simple definition of "interactive" means I have an interface (typically a GUI) which allows me to interact with a SAS session (meaning write and submit code).  So I can submit a step, look at the results, submit another step, etc.  "Batch" means I submit a SAS program and a fresh SAS session is created, the program runs to completion, and the SAS session ends.

 

So Display Manager, EG, Studio are all interactive.  Actually, Studio does have a feature to submit a  "background job", which I would have called "batch submit."  DI Studio I think maintains a SAS session open while a job is open for editing, so I would call it interactive. 

 

I agree with the documentation that 

sas weekly.sas -nodate -linesize 90

and

sas weekly.sas -nodate -linesize 90 &

are both appropriately called "batch".  I would also call a scheduled job a batch job, and would probably call a stored process run through stored process web app a batch submission as well.

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.
mike_bn
Obsidian | Level 7

Thank you Quentin for your answer!

It is probably not worth wasting more of your and other responders time to dwell on that topic

any longer, its just semantics, after all. Just two quick comments

1) As I stated multiple time, my question had nothing to do with interactive modes. I know how to

invoke them and what they are. I just listed them for completeness sake. My question came up

as in some chapters, the SAS doc explicitly states that (apart from interactive modes) two more DIFFERENT SAS execution modes exist: Non-interactive mode and Batch mode.  Two different, distinct modes. So far, no user was able to give a clear answer if this is also true for Unix, and if yes, provide a precise defintion and how to invoke them. Which makes me assume it is not the case for Unix. Imo, in addition to the clear interactive modes (Windows Environment Mode and interactive line mode) there is only one additional third mode. This is invoked by   'sas  mysasprg.sas' or 'sas -sysin mysasprg.sas'  (plus potential options), either by submitting it from the shell command line or scheduled by some scheduler like Cron.  If mysasprg.sas contains no statements that require user input, this mode is clearly non-interactive. Also the & is irrelevant, it only steers whether the process runs in the foreground or in the background. Whether you also always call this 3rd mode a batch mode or only if it is scheduled (by cron or some other scheduler) seems to depend on what your understanding of a batch job is. When I google 'what is a batch job' almost all definitions contain the point that a batch job is scheduled, but maybe there is no clear definition.

2)  Your comments about DIS, EG, Studio etc. are all correct, they are interactive, but I am just talking about BASE SAS and the confusion about batch mode and non-interactive mode.

Tom
Super User Tom
Super User

SAS/Studio is not running SAS interactively.  SAS Studio is interactive, but it is submitting the SAS code in short non-interactive submissions to an independent process that is actually running SAS. I call it pseudo interactive since the sessions remains active between submissions so you are not starting a new SAS session with every submission.

Quentin
Super User

Agree, an EG is pseudo-interactive in the same way.  But I'm happy to call EG and Studio interactive, as they allow you to maintain a SAS session an interact with it.

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.
Quentin
Super User

I think we're on the same page.

 

As per my first post, I think the "non-interactive" is only a z/OS thing.  I wouldn't use that term.

 

So I would call all three of the scenarios you described "batch".  I wouldn't use the "non-interactive" term.

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.
Tom
Super User Tom
Super User

I think the problem is the attempt make some distinction between a "batch" mode and a "non-interactive" mode. 

 

As is normal with computer terminology existing words are adopted and attached to very specific concepts that have only a passing relationship with the ordinary meaning of those words.

 

BATCH is a pretty well defined concept in computers (at least to us old timers) and is not the same as just running a program.  Just running a program at the terminal is not batch.  I don't call it "batch" if I run a compiler. 

 

When I ran SAS from the REXX text editor on a VM/CMS machine I was not running a "batch" job.  The editor script would save the program file and use SAS to run the program.  That was a "non-interactive" run if you will.  So are those that use similar scripts in EMACS to do the same thing on UNIX systems. 

 

If you have a JOB card you are submitting a batch job.  Tools like LSF are using batch queues to run jobs. 

 

When I ran SAS from the WYLBER editor on a MVS system in the 1980's the files I submitted to run had JOB cards are were sent to be batch run.  That was running in batch.

SAS Innovate 2025: Call for Content

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 25 replies
  • 2807 views
  • 13 likes
  • 5 in conversation