BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
csetzkorn
Lapis Lazuli | Level 10

Hi,

 

I am using SAS on a server via Enterprise Guide. Can I also execute a SAS program on my local machine via the command line? Any pointer would be very much appreciated. Thanks.

 

Christian

1 ACCEPTED SOLUTION

Accepted Solutions
csetzkorn
Lapis Lazuli | Level 10

Hi all,

 

I have got it to work using IOM in the end see:

 

http://support.sas.com/resources/papers/proceedings12/017-2012.pdf

 

I can write from Windows to the Unix file system and then use an include. The steps are generate SAS code, write it to file. Use include and IOM to execute SAS code. The SAS code writes to the file system as well, which I can see in Windows. Data can then be uses in C# code.

View solution in original post

13 REPLIES 13
LinusH
Tourmaline | Level 20
If the server and the client uses the same OS, and you can map server drives it's possible.
But why?
You can execute E.G. projects locally, it still the SAS session will execute on the server.
Data never sleeps
csetzkorn
Lapis Lazuli | Level 10

Thanks. Basically, I want to create SAS programs (text files) dynamically (via another program) and then execute the via the command line (in invoked by the program that creates the text files). EG runs on Windows and SAS in Unix, as far as I know. No chance that I can map any drives - our IT is pretty useless. I was also thinking about using stored processes. Ultimately, a stored process is a (restful?) API. This may work in theory but determining the URI of the stored process and authentication may be impossible - I do not expect any support from our IT. Thanks.

error_prone
Barite | Level 11

That's a really bad situation you are in. If you name an Processflow "autoexec" in EG, it will automatically run on loading the project - you have to check an option for the automatism to happen. This is a workaround and not a very good one, but the only one i can think of that does not need the IT involved. Can you create a stored process?

csetzkorn
Lapis Lazuli | Level 10

Thanks I can create stored processes, although there is no clear target operating model (e.g. best practice of deployment). I would also need to know the URI of my stored process. Is there a way of determining this? I intend to write a C# application to consume this. Another alternative is IOM. I once got some C# code working using IOM as a POC. Thanks!

SASKiwi
PROC Star

You can only execute a SAS program on your PC if you have Foundation SAS also installed there. If this is the case then the option "local server" should display when you configure your EG connection profile. If you do have this then just make the local server your active one and you can still use EG to run code locally.

 

If what you mean is: can you run a command line process that will run a SAS program on your remote SAS server? Yes that is possible and one of the options would be the EG scheduling facility.

ChrisNZ
Tourmaline | Level 20

If your only link to the SAS server is EG (i.e. no FTP, no mapped drives, no access to the unix shell from windows, no windows SAS on your PC to talk to the server SAS) then the only way to create or modify or delete or run anything on the unix server is via this interface: EG.

 

In this case, this is not a SAS question, it is a general IT question. If you only have one access method, you can only use this one access method.

csetzkorn
Lapis Lazuli | Level 10
Thanks ChrisNZ. I guess I could use a desktop equivalent to Selenium (a web driver). I also got IOM working to execute some code (see http://support.sas.com/resources/papers/proceedings12/017-2012.pdf). Unfortunately, nothing happens not even an error message. IOM can also be used to invoke stored processes. i will have a look at this ...
Kurt_Bremser
Super User

You can script a SSH client on the Windows side so that it automatically logs on to the UNIX server and executes a command there, that command then being a call of the sasbatch.sh script provided in the SASApp configuration tree.

csetzkorn
Lapis Lazuli | Level 10
Thanks KurtBremser. I won't get access to the server or can I use my SAS credentials to authenticate?
LinusH
Tourmaline | Level 20

@csetzkorn id not already did, you need to talk to your SAS server admin, and potentially UNIX/AD admin and an IT architect so you are not trying to implement a "bad" practice.
If you have a valid use case you should be able to set this up on the server. Driving jobs/batches from local machine is a 20th century thing.

Data never sleeps
csetzkorn
Lapis Lazuli | Level 10

Hi all,

 

I have got it to work using IOM in the end see:

 

http://support.sas.com/resources/papers/proceedings12/017-2012.pdf

 

I can write from Windows to the Unix file system and then use an include. The steps are generate SAS code, write it to file. Use include and IOM to execute SAS code. The SAS code writes to the file system as well, which I can see in Windows. Data can then be uses in C# code.

SASKiwi
PROC Star

Do you have access to SAS Management Console? If you do there is a much easier way. SMC allows you to run SAS batch jobs on your Unix server via a point-and-click interface.

csetzkorn
Lapis Lazuli | Level 10
No - I am just a proletarian SAS consumer

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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