Learning SAS? Welcome to the exclusive online community for all SAS learners.

how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

Reply
Occasional Contributor
Posts: 7

how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

how can we run sas programs in unix batch mode  in sas university edition or in any free sas tool for students ?

Super User
Posts: 17,760

Re: how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

I doubt SAS UE supports batch submission. If you're a student at a institution you should look into if your University offers the full version of SAS.

SAS Super FREQ
Posts: 8,740

Re: how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

Hi:

I don't know what you mean by "Unix batch mode", specifically. To use SAS in batch mode on UNIX, you would

1) have to use a text editor to write/edit your code and then

2) submit the code from a Unix shell script or a Unix command line to SAS. And then

3) SAS would run your code, generate the results and create a .LOG and a .LST file and possibly create other output.

Since SAS is inside a virtual machine in the UE, you cannot get to the Unix command line of the virtual machine and since you cannot get to the Unix operating system, you cannot write or run a shell script.

  But since the code you write will be 90-98% the same whether you write it in SAS Studio or whether you write it inside a Unix text editor like VI, I think that there will turn out to be little difference between the 2 forms of code. Possibly the LIBNAME, INFILE, or FILENAME statements will be different because "regular" Unix will not have shared folders like the UE.

  If you want to learn SAS coding, then just use the CODE window in SAS Studio to write CODE. CODE is CODE. Over my (many) years of working with SAS, I have used many different methods of writing and running SAS programs -- I hate UNIX batch mode because like DOS batch mode, personally, I hate writing scripts to execute my programs. But I CAN write a script if I really have to. I just get my trusty SAS Companion documentation for my operating system. When you're learning SAS and learning how to write SAS programs, it is more important to focus on the code than to focus on the code submission mechanism. The same code that I write in SAS Studio could be submitted in batch on a Unix machine or it could be turned into a stored process to run on the BI platform. But first I have to understand how to write the code.

  Can you explain a little more about why you think you need to run SAS programs in "unix batch mode" as a student?

cynthia

Occasional Contributor
Posts: 7

Re: how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

Thanks Cynthia, yes you are right that code is 90-98% similar Thanks for the explanation . But i want to be familiar with scripts required for unix batch mode because i need to go for  an interview which uses only this method for sas program submission.

Super User
Posts: 17,760

Re: how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

Well, like most academic things, you can study even if you haven't done it for real.

Search for batch submission on lexjansen.com

Occasional Contributor
Posts: 7

Re: how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

Thanks Reeza for sharing the resource , Reeza/Cynthia Can we use batch mode in windows  ?May be if we can  then i can practice scripts on windows.

Super User
Posts: 17,760

Re: how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

Yes, the powershell commands will be similar to Unix - but you still need the full version of SAS.

Super User
Posts: 6,928

Re: how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

There are tons of information concerning shell scripting. One of my favorites:

http://www.gnu.org/software/bash/manual/bash.pdf

since bash is the most widely used UNIX shell today.

You can experiment on any simple Linux box without SAS. In the end, you need to end up with a line like

sas programname.sas -log logfile.log [ insert other parameters here ]

to run the SAS batch program.

If you "echo" this line, you can check if you would have called SAS the way you intended.

Next in the script use $? to catch the return code of the SAS batch run. Then you do post-processing.

From my method:

I use UNIX environment variables to communicate with the SAS batch job

eg input files/datasets are stored in INFILE1, INFILE2, and so on.

A general leadoff %include transforms the environment variables into macro variables using %sysget. This leadoff include is used by all batch programs.

For testing, I use the same program without the leadoff include but supply the macro variables in a piece of code that is normally commented out.

If you want to test without having SAS, just write a script called sas that records all environment variables to the logfile specified on its command line and use that as a dummy. Writing that script will already be a great learning experience.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 7

Re: how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

Thanks Reeza and kurt , i want to  work on sas in unix interactive line mode or batch mode  , please share any resource  on  unix sas or any other alternative of sas full version .

Super User
Posts: 17,760

Re: how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

Can you program in SAS already?

Occasional Contributor
Posts: 7

Re: how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

Thanks Eric for the interview guidance.yes reeza i can program in sas.

Super User
Posts: 17,760

Re: how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

Then batch processing is simply about generating the line:

sas programname.sas -log logfile.log [ insert other parameters here ]


I wouldn't worry too much about it. Good luck with your interview.

Occasional Contributor
Posts: 7

Re: how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

OK Reeza , i will try let see what happen

Respected Advisor
Posts: 3,887

Re: how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

Hi

Running SAS in batch is not that complicated. As preparation for an interview some reading should be more than sufficient. You can't make up for a lack of experience or knowledge within a few days.

I've made in the past very good experiences in interviews with just being honest and open. Don't pretend to know something you don't know. So if asked about your skills/experience in regards of Unix scripting and running SAS in batch I believe you should just "admit" that you've never used it but then also tell that you've already started to skill up on your own.

Especially for junior positions things like "potential", "self driven", "trustworthiness", "soft skills", "how someone might fit into the existing team",... are as important as your actual experience.

Having also sat on the other end of the table when interviewing people one of "the killers" for me is when I start to feel someone is pretending and doesn't tell me the truth - so for example when someone tells me about having skills/experience but then when asking for some examples and detail questions there are only vague answers. If you loose your credibility in an interview situation you're done. You don't have to tell everything but what you tell must be true.

What always helped me in an interview situation is to get myself into a mind-set where I tell myself: I don't need this job, I'm here to find out as much about the employer and if I want to work for them as the employer wants to find out if they want to work with me. So as prep for an interview don't only concentrate on the technical bit but also research the companies website so you learn something about the possible employer and their company culture. Prepare an answer for "why do you want to work for us/in this job" and also think about the questions you want answered at the end of the interview (eg. some info about the people/team you would be working with, career paths & training opportunities and how that's managed within the company etc.).

Good luck

SAS Super FREQ
Posts: 8,740

Re: how can we run sas programs in unix batch mode in sas university edition or in any free sas tool for students ?

As Reeza says, you can study some script examples even you can't submit them on the University Edition.

cynthia

Ask a Question
Discussion stats
  • 18 replies
  • 5637 views
  • 2 likes
  • 8 in conversation