<?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: Assign prompts value in a vbs for SAS Automation in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-prompts-value-in-a-vbs-for-SAS-Automation/m-p/684786#M37042</link>
    <description>&lt;P&gt;If you ever need to convert an Excel number to a character field, the "text" function does this. For example, if A1 is a number, use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=TEXT(A1,"00")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
    <pubDate>Thu, 17 Sep 2020 20:04:29 GMT</pubDate>
    <dc:creator>TomKari</dc:creator>
    <dc:date>2020-09-17T20:04:29Z</dc:date>
    <item>
      <title>Assign prompts value in a vbs for SAS Automation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-prompts-value-in-a-vbs-for-SAS-Automation/m-p/684264#M37008</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a simple code as an example. The program has 1 prompt that opens before running. It is compare which is assigned 0 or 1 so the code executes or not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LIBNAME valid BASE "path" ;&lt;/P&gt;&lt;P&gt;%Let compare_test = &amp;amp;compare;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data valid.test;&lt;BR /&gt;if &amp;amp;compare_test = 1 then do x = 1 to 10;&lt;BR /&gt;y = x*x;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there such a way I could insert something in the VBS file to assign the value for &amp;amp;compare ? Right now my vbs is running, but only with default parameters. Ultimately, I want to transpose this kind of treatement on a much bigger scale for another program with about a dozen prompts to define before running. Any help would be very appreciated !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ty for advice. I've progressed quite a bit, but not there still.&lt;BR /&gt;&lt;BR /&gt;I can now assign value to my prompts manually via the object parameters. I'm now trying via an excel sheet, and everytime i try it does fail.&lt;BR /&gt;&lt;BR /&gt;Here's a part of my VBS. Compare and Date are my two prompts that opens when running the SAS program. If i enter the values manually, it does work. Otherwise if I try to read the excel value it fails. Any insight on that ?&lt;BR /&gt;&lt;BR /&gt;SAS program is already opened at this point.&lt;BR /&gt;&lt;BR /&gt;Set objExcel = CreateObject("Excel.Application")&lt;BR /&gt;Set objWorkbook = objExcel.Workbooks.Open("path")&lt;BR /&gt;Set ws = objWorkbook.Sheets("Invites")&lt;BR /&gt;rowcount = ws.usedrange.rows.count&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Set oparameters = prjobject.Parameters ' Définition des paramètres pour l'exécution du programme SAS&lt;BR /&gt;&lt;BR /&gt;For Each oparameter In oparameters ' Assigner une valeur aux paramètres pertinents&lt;BR /&gt;&lt;BR /&gt;vb_date = ws.cells(y,4)&lt;BR /&gt;vb_compare= ws.cells(y,5)&lt;BR /&gt;&lt;BR /&gt;If oparameter.Name = "Compare" Then oparameter.Value = vb_compare ' 1&lt;BR /&gt;If oparameter.Name = "Date" Then oparameter.Value = vb_date ' "01/01/2020"&lt;BR /&gt;&lt;BR /&gt;Next&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 17:46:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-prompts-value-in-a-vbs-for-SAS-Automation/m-p/684264#M37008</guid>
      <dc:creator>KBou</dc:creator>
      <dc:date>2020-09-17T17:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Assign prompts value in a vbs for SAS Automation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-prompts-value-in-a-vbs-for-SAS-Automation/m-p/684283#M37011</link>
      <description>Please check out this post:&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Calling-SAS-from-VBScript-Setting-Macro-Variables/td-p/52502" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Calling-SAS-from-VBScript-Setting-Macro-Variables/td-p/52502&lt;/A&gt;</description>
      <pubDate>Wed, 16 Sep 2020 15:30:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-prompts-value-in-a-vbs-for-SAS-Automation/m-p/684283#M37011</guid>
      <dc:creator>pink_poodle</dc:creator>
      <dc:date>2020-09-16T15:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Assign prompts value in a vbs for SAS Automation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-prompts-value-in-a-vbs-for-SAS-Automation/m-p/684586#M37018</link>
      <description>&lt;P&gt;In the EG automation model, "Prompts" are&amp;nbsp;ProjectParameter objects, and you get that list from the Project object.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sometimes it might be easier to just set macro variables and/or environment values for your SAS programs to pick up. Use the CodeCollection to add a new program with macro var assignments and run it, like so:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;' add a new code object to the Project
Set sasProgram = Project.CodeCollection.Add
 
 Set the server (by Name) and text for the code
sasProgram.Server = "SASApp"

' Create the SAS program to run, assign macro vars
sasProgram.Text = "%let param = value;"
 
' Run the code
sasProgram.Run&lt;/PRE&gt;
&lt;P&gt;But if your prompts are encoded in tasks, like the Query Builder, then the Project.Parameters property will get you the list.&amp;nbsp; You can then set the Value attribute on each ProjectParameter object.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 13:09:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-prompts-value-in-a-vbs-for-SAS-Automation/m-p/684586#M37018</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2020-09-17T13:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: Assign prompts value in a vbs for SAS Automation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-prompts-value-in-a-vbs-for-SAS-Automation/m-p/684725#M37035</link>
      <description>&lt;P&gt;Ty for advice. I've progressed quite a bit, but not there still.&lt;BR /&gt;&lt;BR /&gt;I can now assign value to my prompts manually via the object parameters. I'm now trying via an excel sheet, and everytime i try it does fail.&lt;BR /&gt;&lt;BR /&gt;Here's a part of my VBS. Compare and Date are my two prompts that opens when running the SAS program. If i enter the values manually, it does work. Otherwise if I try to read the excel value it fails. Any insight on that ?&lt;BR /&gt;&lt;BR /&gt;SAS program is already opened at this point.&lt;BR /&gt;&lt;BR /&gt;Set objExcel = CreateObject("Excel.Application")&lt;BR /&gt;Set objWorkbook = objExcel.Workbooks.Open("path")&lt;BR /&gt;Set ws = objWorkbook.Sheets("Invites")&lt;BR /&gt;rowcount = ws.usedrange.rows.count&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Set oparameters = prjobject.Parameters ' Définition des paramètres pour l'exécution du programme SAS&lt;BR /&gt;&lt;BR /&gt;For Each oparameter In oparameters ' Assigner une valeur aux paramètres pertinents&lt;BR /&gt;&lt;BR /&gt;vb_date = ws.cells(y,4)&lt;BR /&gt;vb_compare= ws.cells(y,5)&lt;BR /&gt;&lt;BR /&gt;If oparameter.Name = "Compare" Then oparameter.Value = vb_compare ' 1&lt;BR /&gt;If oparameter.Name = "Date" Then oparameter.Value = vb_date ' "01/01/2020"&lt;BR /&gt;&lt;BR /&gt;Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It all worked out finally. The cells were formatted on date format on my Excel. Switched it to standard and worked on the first try.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good to know if anyone has the same issue&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 18:57:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-prompts-value-in-a-vbs-for-SAS-Automation/m-p/684725#M37035</guid>
      <dc:creator>KBou</dc:creator>
      <dc:date>2020-09-17T18:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Assign prompts value in a vbs for SAS Automation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-prompts-value-in-a-vbs-for-SAS-Automation/m-p/684732#M37036</link>
      <description>&lt;P&gt;I'd say make sure the Value you assign is a text value -- if you pull the value from an Excel object, it might not interpret as text.&amp;nbsp; Probably a way to get the text representation of the Excel cell value though, right?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 18:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-prompts-value-in-a-vbs-for-SAS-Automation/m-p/684732#M37036</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2020-09-17T18:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Assign prompts value in a vbs for SAS Automation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-prompts-value-in-a-vbs-for-SAS-Automation/m-p/684751#M37037</link>
      <description>&lt;P&gt;Thank you sir, it gave me the good insight to find myself potnetial error sources.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've put my excel sheet cells on date formats. Once I switched it to standard, it made my code work !&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 18:56:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-prompts-value-in-a-vbs-for-SAS-Automation/m-p/684751#M37037</guid>
      <dc:creator>KBou</dc:creator>
      <dc:date>2020-09-17T18:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: Assign prompts value in a vbs for SAS Automation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-prompts-value-in-a-vbs-for-SAS-Automation/m-p/684786#M37042</link>
      <description>&lt;P&gt;If you ever need to convert an Excel number to a character field, the "text" function does this. For example, if A1 is a number, use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=TEXT(A1,"00")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 20:04:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-prompts-value-in-a-vbs-for-SAS-Automation/m-p/684786#M37042</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2020-09-17T20:04:29Z</dc:date>
    </item>
  </channel>
</rss>

