<?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: Pass parameter from Powershell to SAS EG in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Pass-parameter-from-Powershell-to-SAS-EG/m-p/546949#M33318</link>
    <description>&lt;P&gt;If you're using the SAS Enterprise Guide automation APIs, then anything you can do in VB Script can also be done in Powershell.&amp;nbsp; You've &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Doing-More-with-SAS-Enterprise-Guide-Automation/ta-p/417832" target="_self"&gt;seen the examples in this article&lt;/A&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In terms of using automation to&amp;nbsp;&lt;STRONG&gt;add&lt;/STRONG&gt; content to a project, there aren't many options.&amp;nbsp; You can create a new Code item (SAS program) and run it via automation, but you can't add other types of objects like data, query tasks, or other types of tasks/flows.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Mar 2019 16:44:20 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2019-03-28T16:44:20Z</dc:date>
    <item>
      <title>Pass parameter from Powershell to SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Pass-parameter-from-Powershell-to-SAS-EG/m-p/546942#M33317</link>
      <description>&lt;P&gt;Is it possible to pass a parameter from Powershell into a SAS project with the application or project classes?&amp;nbsp; I am calling these to run SAS EG projects in an automated fashion based on lookups I'm doing out of Excel.&amp;nbsp; I have also found the projectparamter class in the scheduling documentation, but from my limited understanding these look more intended for pulling from a project than pushing into.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have found some examples with VB using SYSPARAM, however, I'm yet to find an actual powershell call that does this so far.&amp;nbsp; I would prefer to house everything in powershell if possible.&amp;nbsp; Just trying to understand if I'm burning my time trying to figure it out in powershell.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2019 16:22:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Pass-parameter-from-Powershell-to-SAS-EG/m-p/546942#M33317</guid>
      <dc:creator>jbbell</dc:creator>
      <dc:date>2019-03-28T16:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: Pass parameter from Powershell to SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Pass-parameter-from-Powershell-to-SAS-EG/m-p/546949#M33318</link>
      <description>&lt;P&gt;If you're using the SAS Enterprise Guide automation APIs, then anything you can do in VB Script can also be done in Powershell.&amp;nbsp; You've &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Doing-More-with-SAS-Enterprise-Guide-Automation/ta-p/417832" target="_self"&gt;seen the examples in this article&lt;/A&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In terms of using automation to&amp;nbsp;&lt;STRONG&gt;add&lt;/STRONG&gt; content to a project, there aren't many options.&amp;nbsp; You can create a new Code item (SAS program) and run it via automation, but you can't add other types of objects like data, query tasks, or other types of tasks/flows.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2019 16:44:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Pass-parameter-from-Powershell-to-SAS-EG/m-p/546949#M33318</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2019-03-28T16:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Pass parameter from Powershell to SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Pass-parameter-from-Powershell-to-SAS-EG/m-p/546962#M33319</link>
      <description>&lt;P&gt;Chris,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the quick response.&amp;nbsp; I was able to hack together a VB example I found with the API documentation.&amp;nbsp; Thought I would throw it back out here in case anyone in the future would like a working example.&amp;nbsp; Fair warning, all this does is create a new code node with the contents of $fileString.&amp;nbsp; Still working out the rest of the process, such as execution order and calling inside of a filter.&amp;nbsp; It's in a loop, but that is just because it's part of something I'm developing.&amp;nbsp; You don't really need the loop if you only have one project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also thanks for the documentation and github repo you have out there.&amp;nbsp; Was very helpful in trying to sort this out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;$Projects = 'Path/To/Project.egp'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;foreach($project in $Projects) {&lt;BR /&gt;Write-Host "Processing SAS EG Project: " $project&lt;BR /&gt;$eguideApp = New-Object -ComObject SASEGObjectModel.Application.7.1&lt;BR /&gt;$egProject = $eguideApp.Open($project,"")&lt;BR /&gt;$fileString = "Your String to Pass"&lt;BR /&gt;$SASPgmObj = $egProject.CodeCollection.Add()&lt;BR /&gt;$SASPgmObj.Text = $fileString&lt;BR /&gt;$SASPgmObj.Run&lt;/P&gt;&lt;P&gt;$egProject.run()&lt;BR /&gt;$egProject.save()&lt;BR /&gt;$egProject.close()&lt;BR /&gt;$eguideApp.Quit()&lt;BR /&gt;Write-Host "Processed: " $project&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2019 17:26:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Pass-parameter-from-Powershell-to-SAS-EG/m-p/546962#M33319</guid>
      <dc:creator>jbbell</dc:creator>
      <dc:date>2019-03-28T17:26:47Z</dc:date>
    </item>
  </channel>
</rss>

