BookmarkSubscribeRSS Feed
tom12122
Obsidian | Level 7

I tried to execute macros that contain PIPE commands but I get error saying that I need some special prividges to run this command. Where and how exactly should I set those priviledges - I can execute these commands in "normal window" SAS and iom povider also runs "locally" so it should have the same settings, shouldn't it?

5 REPLIES 5
Patrick
Opal | Level 21

You need to set SAS invocation option 'XCMD'

Below link explains it all:

NOXCMD: NO eXternal CoMmanDs! - platformadmin.com

tom12122
Obsidian | Level 7

But the problem is that i don't have sas server running - I connect using iom.provider using ADO

http://support.sas.com/documentation/cdl/en/oledbpr/59558/PDF/default/oledbpr.pdf

Patrick
Opal | Level 21

For connecting to a locally installed SAS without a pre-existing session / SAS\Share I find the following in the docu link you've posted:

Dim obConnection As New ADODB.Connection

obConnection.Provider = "sas.BaseSASProvider"

obConnection.Properties("Data Source") = "sdplserv"

obConnection.Properties("SAS Executable") = "C:\\Program Files\\SAS\\SASFoundation\\9.2\\sas.exe"

obConnection.Properties("SAS Parameters") = "-initstmt %sasodbc(sdplserv) -icon -nosplash"

obConnection.Properties("SAS Working Directory") = "C:\\Program Files\\SAS\\SASFoundation\9.2\\"

obConnection.Open

In my understanding what this does is creating a new SAS session - and when this happens configuration files and autoexec files get executed during SAS invocation.

Setting XCMD as described in the link from Paul Holmes which I've posted should then allow you to execute SAS code using shell escape.

What I possibly should add: If you want to be sure that your job gets an identical environment than when running out of PC SAS then look up how your PC SAS starts (i.e. right click on your SAS link under "start/programs", go to "properties" and under tab "Shortcut" use the "Target" path. Then add this target path as a connection property. On the local SAS installation on my laptop this would be (not tested):

obConnection.Properties("SAS Parameters") = '-CONFIG "C:\Program Files\SASHome\SASFoundation\9.3\nls\en\sasv9.cfg"'

http://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/viewer.htm#win-sysop-config.h...

tom12122
Obsidian | Level 7

But I need to use IOM Provider - where can I find XCMD setting for this?

Patrick
Opal | Level 21

I'm not the specialist in this but the IOM provider simply provides connectivity to SAS. You ARE creating a new SAS session and I understand more or less how this works.

During SAS invocation first the config files (.cfg) and then the autoexec files (.sas) get executed. Config and Autoexec files create your SAS environment of which the option setting of "XMCD" or "NOXCMD" is part. Config files and Autoexec files are "cascading" meaning that the first config file can "call" an additional config file ...and so on. So you need to find the first in the list and the entries in there will tell you what other config and autoexec files get executed.

I believe that the first config file in the list is the one which sits in the same folder than the "sas.exe" you're calling - so you know where to start from. Just set "options XCMD;" in one of the autoexecs or if you have SAS Mangement Console then modify the value there as explained in Paul Holmes link.

How SAS starts up is documented. Using the IOM provider is what a lot of SAS clients do (for example SAS EG). So you can also find a lot of information about this there (a keyword could be "object spawner").

Not sure if this would work but you could also try

obConnection.Properties("SAS Executable") = "C:\\Program Files\\SAS\\SASFoundation\\9.2\\sas.exe -XCMD"

I would expect this not to work as the "NOXCMD" setting in SAS Metadata gets executed later. But again: I'm not really a SAS Admin. Just a guy who sometimes needs to make things work at client site if no experienced SAS Admin is around.

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!

Discussion stats
  • 5 replies
  • 1411 views
  • 0 likes
  • 2 in conversation