<?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 Calling SAS from VBScript - Setting Macro Variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calling-SAS-from-VBScript-Setting-Macro-Variables/m-p/52502#M11084</link>
    <description>I have been learning to call SAS from VBScripts, but have had little luck finding resources for this.  I have a script that opens as SAS project, runs two code files, Saves, and exits.  I need to be able to set a macro variable from the script, but I have no idea how.  Here is my script:&lt;BR /&gt;
&lt;BR /&gt;
'Set ErrorHandler&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
&lt;BR /&gt;
'Run Daily&lt;BR /&gt;
ProjectName = "\\Nasvs1\Shared\4700Mac\Shared3\Actuarial\SAS\Projects\ISO.egp"&lt;BR /&gt;
Files = Array("LIBRARIES", "PLCY")&lt;BR /&gt;
Call Work(ProjectName, Files)&lt;BR /&gt;
&lt;BR /&gt;
'Define Functions&lt;BR /&gt;
Sub Work(ProjectName, Files)&lt;BR /&gt;
	Set App = CreateObject("SASEGObjectModel.Application.4")&lt;BR /&gt;
	Set Project = App.Open(ProjectName,"")&lt;BR /&gt;
	Set Container = Project.CodeCollection&lt;BR /&gt;
	For Each File In Files&lt;BR /&gt;
		For Each Object In Container&lt;BR /&gt;
			If Object.Name = File Then Object.Run&lt;BR /&gt;
		Next&lt;BR /&gt;
	Next&lt;BR /&gt;
	Project.Save&lt;BR /&gt;
	Project.Close&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
'Reset Error Handler&lt;BR /&gt;
On Error Goto 0&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Here is the variable in the file PLCY that I would like to set:&lt;BR /&gt;
&lt;BR /&gt;
%LET INFILE = "&amp;amp;ISODATA.G0024P1_D110415.TXT";&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Any help would be greatly appreciated!&lt;BR /&gt;
&lt;BR /&gt;
Chris</description>
    <pubDate>Mon, 18 Apr 2011 17:23:50 GMT</pubDate>
    <dc:creator>cjohnson</dc:creator>
    <dc:date>2011-04-18T17:23:50Z</dc:date>
    <item>
      <title>Calling SAS from VBScript - Setting Macro Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-SAS-from-VBScript-Setting-Macro-Variables/m-p/52502#M11084</link>
      <description>I have been learning to call SAS from VBScripts, but have had little luck finding resources for this.  I have a script that opens as SAS project, runs two code files, Saves, and exits.  I need to be able to set a macro variable from the script, but I have no idea how.  Here is my script:&lt;BR /&gt;
&lt;BR /&gt;
'Set ErrorHandler&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
&lt;BR /&gt;
'Run Daily&lt;BR /&gt;
ProjectName = "\\Nasvs1\Shared\4700Mac\Shared3\Actuarial\SAS\Projects\ISO.egp"&lt;BR /&gt;
Files = Array("LIBRARIES", "PLCY")&lt;BR /&gt;
Call Work(ProjectName, Files)&lt;BR /&gt;
&lt;BR /&gt;
'Define Functions&lt;BR /&gt;
Sub Work(ProjectName, Files)&lt;BR /&gt;
	Set App = CreateObject("SASEGObjectModel.Application.4")&lt;BR /&gt;
	Set Project = App.Open(ProjectName,"")&lt;BR /&gt;
	Set Container = Project.CodeCollection&lt;BR /&gt;
	For Each File In Files&lt;BR /&gt;
		For Each Object In Container&lt;BR /&gt;
			If Object.Name = File Then Object.Run&lt;BR /&gt;
		Next&lt;BR /&gt;
	Next&lt;BR /&gt;
	Project.Save&lt;BR /&gt;
	Project.Close&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
'Reset Error Handler&lt;BR /&gt;
On Error Goto 0&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Here is the variable in the file PLCY that I would like to set:&lt;BR /&gt;
&lt;BR /&gt;
%LET INFILE = "&amp;amp;ISODATA.G0024P1_D110415.TXT";&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Any help would be greatly appreciated!&lt;BR /&gt;
&lt;BR /&gt;
Chris</description>
      <pubDate>Mon, 18 Apr 2011 17:23:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-SAS-from-VBScript-Setting-Macro-Variables/m-p/52502#M11084</guid>
      <dc:creator>cjohnson</dc:creator>
      <dc:date>2011-04-18T17:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS from VBScript - Setting Macro Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-SAS-from-VBScript-Setting-Macro-Variables/m-p/52503#M11085</link>
      <description>Since you are using SAS Enterprise Guide, you might want to post this question to the SAS Enterprise Guide forum. The folks who use VBScript with EG are mostly over there.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Mon, 18 Apr 2011 19:29:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-SAS-from-VBScript-Setting-Macro-Variables/m-p/52503#M11085</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-04-18T19:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS from VBScript - Setting Macro Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-SAS-from-VBScript-Setting-Macro-Variables/m-p/52504#M11086</link>
      <description>One straight-forward way is: Read the PLCY file and insert or replace the %LET INFILE... line with something you want and then run the rest of the code.</description>
      <pubDate>Mon, 18 Apr 2011 20:37:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-SAS-from-VBScript-Setting-Macro-Variables/m-p/52504#M11086</guid>
      <dc:creator>chang_y_chung_hotmail_com</dc:creator>
      <dc:date>2011-04-18T20:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS from VBScript - Setting Macro Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calling-SAS-from-VBScript-Setting-Macro-Variables/m-p/52505#M11087</link>
      <description>Thanks.  That helps.  Can you submit/run code in EG without inserting it into a code file?&lt;BR /&gt;
&lt;BR /&gt;
For example, in SAS (not EG), you can do something like this:&lt;BR /&gt;
&lt;BR /&gt;
Set objSAS = Wscript.CreateObject("SAS.Application.8")&lt;BR /&gt;
objSAS.Submit("data test;a=1;output;proc print;run;")</description>
      <pubDate>Tue, 19 Apr 2011 12:10:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calling-SAS-from-VBScript-Setting-Macro-Variables/m-p/52505#M11087</guid>
      <dc:creator>cjohnson</dc:creator>
      <dc:date>2011-04-19T12:10:03Z</dc:date>
    </item>
  </channel>
</rss>

