04-13-2013 03:07 PM
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?
04-14-2013 03:53 AM
But the problem is that i don't have sas server running - I connect using iom.provider using ADO
04-14-2013 05:33 AM
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\\"
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"'
04-17-2013 08:02 AM
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.