<?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: ERROR: Unable to get SAS code. Unable to find the specified file. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Unable-to-get-SAS-code-Unable-to-find-the-specified-file/m-p/739157#M230667</link>
    <description>&lt;P&gt;It looks like the F: drive is unavailable to the scheduler.&lt;/P&gt;
&lt;P&gt;This about why this could be the case on your machine,&lt;/P&gt;
&lt;P&gt;A common reason is that it's a network drive unauthorised to the user chosen to run the batch job.&lt;/P&gt;</description>
    <pubDate>Wed, 05 May 2021 07:49:03 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2021-05-05T07:49:03Z</dc:date>
    <item>
      <title>ERROR: Unable to get SAS code. Unable to find the specified file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Unable-to-get-SAS-code-Unable-to-find-the-specified-file/m-p/739156#M230666</link>
      <description>&lt;P&gt;I am using the "Schedule Task" option with SAS EG (with the VBScript) to run a project during the night.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When running it manually it works perfectly, however when it is using the Scheduler, every morning the same error appears:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %put ERROR: Unable to get SAS code. Unable to find the specified file.;
ERROR: Unable to get SAS code. Unable to find the specified file.
4          
5          QUIT; RUN;&lt;/PRE&gt;&lt;P&gt;I checked the VBScript and the path to the file seems right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Option Explicit
Dim app         ' As SASEGuide.Application

Call dowork

'shut down the app
If not (app Is Nothing) Then
    app.Quit
    Set app = Nothing
End If


Sub dowork()
    On Error Resume Next
    '----
    ' Start up Enterprise Guide using the project name
    '----
    Dim prjName     ' As String
    Dim prjObject   ' As SASEGuide.Project
    Dim containerName     ' As String
    Dim containerObject   ' As SASEGuide.Container
    Dim containerColl     ' As SASEGuide.ContainerCollection

    prjName = "F:\path\to\my\file.egp" ' Project Name
    containerName = "Process Flow" ' Container Name
      
    Set app = CreateObject("SASEGObjectModel.Application.8.1")
    If Checkerror("CreateObject") = True Then
        Exit Sub
    End If
    
    Set prjObject = app.Open(prjName,"")
    If Checkerror("App.Open") = True Then
        Exit Sub
    End If
    
        
    '-----
    'Get The Container Collection and Object
    '-----    
    Set containerColl = prjObject.ContainerCollection
    If Checkerror("Project.ContainerCollection") = True Then
        Exit Sub
    End If
    
    Dim i       ' As Long
    Dim count   ' As Long
    count = containerColl.count
    For i = 0 To count - 1
        Set containerObject = containerColl.Item(i)
        If Checkerror("ContainerCollection.Item") = True Then
            Exit Sub
        End If
        
        If (containerObject.Name = containerName) Then
            Exit For
        Else
            Set containerObject = Nothing
        End If
    Next 
    
    If not (containerObject Is Nothing) Then
        '----
        ' Run the Container
        '----
        containerObject.Run
        If Checkerror("Container.Run") = True Then
            Exit Sub
        End If               
    End If
                
    '-----
    ' Save the new project
    '-----
    prjObject.Save
    If Checkerror("Project.Save") = True Then
        Exit Sub
    End If
    
    '-----
    ' Close the project
    '-----
    prjObject.Close
    If Checkerror("Project.Close") = True Then
        Exit Sub
    End If
       
End Sub

Function Checkerror(fnName)
    Checkerror = False
    
    Dim strmsg      ' As String
    Dim errNum      ' As Long
    
    If Err.Number &amp;lt;&amp;gt; 0 Then
        strmsg = "Error #" &amp;amp; Hex(Err.Number) &amp;amp; vbCrLf &amp;amp; "In Function " &amp;amp; fnName &amp;amp; vbCrLf &amp;amp; Err.Description
        'MsgBox strmsg  'Uncomment this line if you want to be notified via MessageBox of Errors in the script.
        Checkerror = True
    End If
         
End Function&lt;/PRE&gt;&lt;P&gt;Am I missing something ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 07:41:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Unable-to-get-SAS-code-Unable-to-find-the-specified-file/m-p/739156#M230666</guid>
      <dc:creator>KermitTheFrog</dc:creator>
      <dc:date>2021-05-05T07:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Unable to get SAS code. Unable to find the specified file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Unable-to-get-SAS-code-Unable-to-find-the-specified-file/m-p/739157#M230667</link>
      <description>&lt;P&gt;It looks like the F: drive is unavailable to the scheduler.&lt;/P&gt;
&lt;P&gt;This about why this could be the case on your machine,&lt;/P&gt;
&lt;P&gt;A common reason is that it's a network drive unauthorised to the user chosen to run the batch job.&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 07:49:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Unable-to-get-SAS-code-Unable-to-find-the-specified-file/m-p/739157#M230667</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-05-05T07:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Unable to get SAS code. Unable to find the specified file.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Unable-to-get-SAS-code-Unable-to-find-the-specified-file/m-p/739158#M230668</link>
      <description>&lt;P&gt;Also: Maybe use the UNC oath instead of a mapped drive letter.&lt;/P&gt;
&lt;P&gt;Mapping drives is best avoided, it creates all sorts of problems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 07:50:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Unable-to-get-SAS-code-Unable-to-find-the-specified-file/m-p/739158#M230668</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-05-05T07:50:30Z</dc:date>
    </item>
  </channel>
</rss>

