<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Trying to run SAS Program as a Windows Service in Administration and Deployment</title>
    <link>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264708#M4807</link>
    <description>&lt;P&gt;Try running your test program as a batch job from a Windows command prompt. Does it work OK?&lt;/P&gt;</description>
    <pubDate>Tue, 19 Apr 2016 04:28:51 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2016-04-19T04:28:51Z</dc:date>
    <item>
      <title>Trying to run SAS Program as a Windows Service</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264511#M4800</link>
      <description>&lt;P&gt;I want to run a SAS program as a windows service in Windows Server 2008 R2 on SAS 9.3.&lt;BR /&gt;I have written a sample SAS code that creates a data set test in C drive as follows:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;libname path "C:\";&lt;/P&gt;&lt;P&gt;data path.test;&lt;BR /&gt;result = "Through service";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next, I'm trying to create a SAS Service using SAS Service Configuration Utility as per the following link&lt;A title="Starting SAS as a windows service" href="http://support.sas.com/documentation/cdl/en/hostwin/63047/HTML/default/viewer.htm#n11p2kzepqm4abn1f2aew2c0lo9l.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/hostwin/63047/HTML/default/viewer.htm#n11p2kzepqm4abn1f2aew2c0lo9l.htm&lt;/A&gt;. Kindly refer to the attached screenshot for the parameters.&lt;/P&gt;&lt;P&gt;Below are the different variations that I have used as&amp;nbsp;the service path:&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;"E:\SASHome\SASFoundation\9.3\sas.exe" -SYSIN "C:\MyPgm.sas"&lt;/P&gt;&lt;P&gt;2.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"E:\SASHome\SASFoundation\9.3\sas.exe" -noterminal -SYSIN "C:\MyPgm.sas"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3.&amp;nbsp;&lt;SPAN&gt;"E:\SASHome\SASFoundation\9.3\sas.exe" -noterminal -SYSIN "C:\MyPgm.sas" -config "E:\SASHome\SASFoundation\9.3\nls\en\SASV9.CFG"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In all the scenarios, I'm getting the following error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"Windows could not start the SAS_service service on local computer.&lt;BR /&gt;Error 1067: The process terminated unexpectedly."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help in this regard would be highly appreciated.&lt;BR /&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12467i264959236E849215/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Error.jpg" title="Error.jpg" /&gt;</description>
      <pubDate>Mon, 18 Apr 2016 09:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264511#M4800</guid>
      <dc:creator>gurbeer</dc:creator>
      <dc:date>2016-04-18T09:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to run SAS Program as a Windows Service</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264527#M4801</link>
      <description>&lt;P&gt;Looks like the environment in which the Windows service runs can't see your network drive E:&lt;/P&gt;
&lt;P&gt;Most probably because E: is mounted after you log on.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 10:29:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264527#M4801</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-04-18T10:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to run SAS Program as a Windows Service</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264546#M4802</link>
      <description>&lt;P&gt;Actually, I had thought so and that's why I logged on to the server and tried to run the serevice manually. Still&amp;nbsp;the same error.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 12:29:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264546#M4802</guid>
      <dc:creator>gurbeer</dc:creator>
      <dc:date>2016-04-18T12:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to run SAS Program as a Windows Service</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264547#M4803</link>
      <description>&lt;P&gt;Did you try&lt;/P&gt;
&lt;PRE&gt;E:\SASHome\SASFoundation\9.3\sas.exe -SYSIN C:\MyPgm.sas&lt;/PRE&gt;
&lt;P&gt;(no quotes needed, as there are no blanks in the file/pathnames) straight from the commandline? And what messages did you get?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 12:38:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264547#M4803</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-04-18T12:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to run SAS Program as a Windows Service</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264708#M4807</link>
      <description>&lt;P&gt;Try running your test program as a batch job from a Windows command prompt. Does it work OK?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 04:28:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264708#M4807</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2016-04-19T04:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to run SAS Program as a Windows Service</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264712#M4808</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi﻿&lt;/a&gt;,&amp;nbsp;I have tried what you have asked. It works as expected - creates a data set test at desired location. Refer to the attached screenshot for the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser﻿&lt;/a&gt;,&amp;nbsp;I have also tried what you have asked and it still didn't work. However, in the bat file created, I have not used quotes - you can refer to the screenshot, and it worked fine.&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12470i275BCF68D212796F/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Error1.jpg" title="Error1.jpg" /&gt;</description>
      <pubDate>Tue, 19 Apr 2016 05:20:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264712#M4808</guid>
      <dc:creator>gurbeer</dc:creator>
      <dc:date>2016-04-19T05:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to run SAS Program as a Windows Service</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264713#M4809</link>
      <description>&lt;P&gt;If SAS does not complain immediately, it has run the program. Look what's in C:\MyPgm.log.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 05:30:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264713#M4809</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-04-19T05:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to run SAS Program as a Windows Service</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264729#M4810</link>
      <description>&lt;P&gt;Since your batch job test worked OK I think that confirms that you are invoking SAS correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What happens if you add a statement using the SLEEP function to your test DATA step - telling your program to sleep for 5 minutes (RC = sleep(60 * 5); ). Does your Windows service continue OK for 5 minutes then stop or does it still stop immediately? &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 07:36:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264729#M4810</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2016-04-19T07:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to run SAS Program as a Windows Service</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264748#M4811</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser﻿&lt;/a&gt;, since service isn't getting started, SAS isn't even getting invoked - so no logs in this case.&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi﻿&lt;/a&gt;, I'd say my understanding here is that since SAS isn't even getting invoked, so introducing sleep or for that matter changing anything in the data step may not be helpful&amp;nbsp;as my SAS code isn't even getting executed. I believe firstly, I need to be able to invoke SAS from Services.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 10:01:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264748#M4811</guid>
      <dc:creator>gurbeer</dc:creator>
      <dc:date>2016-04-19T10:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to run SAS Program as a Windows Service</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264751#M4812</link>
      <description>&lt;P&gt;What about your user account? Do you have appropriate admin rights to create a Windows service?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 10:23:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264751#M4812</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2016-04-19T10:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to run SAS Program as a Windows Service</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264758#M4813</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/81654"&gt;@gurbeer&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;, since service isn't getting started, SAS isn't even getting invoked - so no logs in this case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I was not talking about what happens when you run it as a service, I was talking about running it from the commandline directly.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 10:58:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264758#M4813</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-04-19T10:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to run SAS Program as a Windows Service</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264767#M4814</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi﻿&lt;/a&gt;, I'm not very sure about whether I have&amp;nbsp;rights to start a service or not. I'm able to create one, so, I assumed I can simply start one too. But then, shouldn't that give an error saying something similar to rights required to start a service or something?&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser﻿&lt;/a&gt;, I was able to run it through commandline and generate a log file as attached, which says the data set created successfully.&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12472i232C8724C2DCA3F4/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Log.jpg" title="Log.jpg" /&gt;</description>
      <pubDate>Tue, 19 Apr 2016 11:57:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264767#M4814</guid>
      <dc:creator>gurbeer</dc:creator>
      <dc:date>2016-04-19T11:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to run SAS Program as a Windows Service</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264772#M4815</link>
      <description>&lt;P&gt;I just googled the 1067 error, and it seems to indicate that the service in question (SAS in your case) exited with an exit code &amp;lt;&amp;gt; 0.&lt;/P&gt;
&lt;P&gt;My next tries would be&lt;/P&gt;
&lt;P&gt;- write a simple .bat that echoes some text into c:\test.txt&lt;/P&gt;
&lt;P&gt;- try to run that as a service&lt;/P&gt;
&lt;P&gt;- if that works, add the SAS command line in the batch file, capture the exit code immediately after, and echo that to C:\test.txt&lt;/P&gt;
&lt;P&gt;- see which exit code came from SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have to say, though, that I am always astonished by how complicated such simple tasks are in Windows. By $DEITY, am I glad my SAS server runs on UNIX!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 12:32:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Trying-to-run-SAS-Program-as-a-Windows-Service/m-p/264772#M4815</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-04-19T12:32:39Z</dc:date>
    </item>
  </channel>
</rss>

