<?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: Setting date range ProjectParameter objects in a SAS EG automation in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Setting-date-range-ProjectParameter-objects-in-a-SAS-EG/m-p/676544#M36720</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/149110"&gt;@saslover15&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi Tom! Thanks! We will make sure about the quotes. Yes, parameters do become macro variables. This is VB.net code I posted. But HOW do we access the macro variables in the first place to be able to set their values before the SAS code run? That is where we are stuck. HOW to access the macro variables.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In EG the user is prompted to make a selection. If you read the thread you linked the best suggestion is to just write your code to use the same macro variable names as the EG prompt was generating.&amp;nbsp; And then just call the code via some easy to replicate process.&amp;nbsp; Like the Unix command line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Say it was generating these two macro variables.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date_min=01AUG2019;
%let date_max=01JAN2020;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then the code is normally written to just use the macro variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where somedate between "&amp;amp;date_min"d and "&amp;amp;date_max"d &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now if you wanted to make the same code work if instead the values are present in environment variables named date_min and date_max instead you could add at the top of the program:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if 0=%length(&amp;amp;date_min) and 0&amp;lt;%sysfunc(envlen(date_min)) %then %do;
  %let date_min=%sysget(date_min);
%end;
%if 0=%length(&amp;amp;date_max) and 0&amp;lt;%sysfunc(envlen(date_max)) %then %do;
  %let date_max=%sysget(date_max);
%end;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then if you are running the code via EG and the user has answered the prompts the macro variables are set.&amp;nbsp; But if you want to run it outside of EG you can just use the -set command line option to set the dates into the corresponding environment variables instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Aug 2020 16:44:17 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-08-13T16:44:17Z</dc:date>
    <item>
      <title>Setting date range ProjectParameter objects in a SAS EG automation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Setting-date-range-ProjectParameter-objects-in-a-SAS-EG/m-p/675779#M36681</link>
      <description>&lt;P&gt;So we figured out how to automate our project with help from these boards, as we are able to set the values of most ProjectParameter objects, per this post:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/Is-it-possible-to-run-a-SAS-EG-project-THAT-NEEDS-PROMPTS-TO-BE/m-p/631895#M35688" target="_blank"&gt;https://communities.sas.com/t5/SAS-Enterprise-Guide/Is-it-possible-to-run-a-SAS-EG-project-THAT-NEEDS-PROMPTS-TO-BE/m-p/631895#M35688&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So we are able to set the value when a field is just a free-form text field, &amp;nbsp;a password field, or a drop-down list.&amp;nbsp; But we are stuck on fields where a user picks a date range from the prompt window using the little calendar icons.&amp;nbsp; For now, we have the date ranges defaulted in the egp files, so that the automation will run successfully, but obviously we want the user to pick what dates they want, rather than using the defaults.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a date range field, there is only one parameter, but two values.&amp;nbsp;The date range prompt, for example,&amp;nbsp;has a name of PAID_DATE....when we run in thein the project it comes through&amp;nbsp;as PAID_DATE_min and PAID_DATE_max, but we cannot fine where these parameter values are set anywhere in the ProjectParameter objects.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone have any clues how to set parameters for date ranges in an automation?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2020 22:34:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Setting-date-range-ProjectParameter-objects-in-a-SAS-EG/m-p/675779#M36681</guid>
      <dc:creator>saslover15</dc:creator>
      <dc:date>2020-08-10T22:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Setting date range ProjectParameter objects in a SAS EG automation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Setting-date-range-ProjectParameter-objects-in-a-SAS-EG/m-p/675972#M36694</link>
      <description>&lt;P&gt;Here is an update and clarification of the problem we are having..&amp;nbsp; This "Case" statement below needs a "Select Case", such as:&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;FONT face="Calibri" color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-family: Consolas;"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select Case &lt;STRONG&gt;SomeVariableName&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt 0.5in; text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: Consolas;"&gt;&lt;FONT color="#000000"&gt;Case "PD_DT_min" ' ProjectParmTypeDate(0)&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt 1in; text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: Consolas;"&gt;&lt;FONT color="#000000"&gt;prm.Value = ‘“01Jan2019”’&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt 0.5in; text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: Consolas;"&gt;&lt;FONT color="#000000"&gt;Case "PD_DT_max" ' ProjectParmTypeDate(0)&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt 1in; text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: Consolas;"&gt;&lt;FONT color="#000000"&gt;prm.Value = ‘“12Dec2019”&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-family: Consolas;"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Select&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in 0in 0pt;"&gt;&lt;SPAN style="font-family: Consolas;"&gt;&lt;FONT color="#000000"&gt;It doesn't matter WHAT we fill in for "SomeVariableName" - we have tried just PD_DT, among other things - nothing works, all fail.&amp;nbsp; Can a date range simply NOT be done in an egp file intended for automation?&amp;nbsp; What should we be filling in for "SomeVariableName" to be able to pass a date range in?&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2020 18:04:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Setting-date-range-ProjectParameter-objects-in-a-SAS-EG/m-p/675972#M36694</guid>
      <dc:creator>saslover15</dc:creator>
      <dc:date>2020-08-11T18:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Setting date range ProjectParameter objects in a SAS EG automation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Setting-date-range-ProjectParameter-objects-in-a-SAS-EG/m-p/675976#M36695</link>
      <description>&lt;P&gt;Make sure the real code does not have the "smart" quotes you posted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't parameters become macro variables?&amp;nbsp; Why aren't you referencing the macro variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is that SAS code?&amp;nbsp; What is the (0) after &lt;SPAN&gt;ProjectParmTypeDate&lt;/SPAN&gt;?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2020 18:47:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Setting-date-range-ProjectParameter-objects-in-a-SAS-EG/m-p/675976#M36695</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-11T18:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: Setting date range ProjectParameter objects in a SAS EG automation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Setting-date-range-ProjectParameter-objects-in-a-SAS-EG/m-p/675981#M36696</link>
      <description>Hi Tom!  Thanks! We will make sure about the quotes.  Yes, parameters do become macro variables.   This is VB.net code I posted.  But HOW do we access the macro variables in the first place to be able to set their values before the SAS code run?  That is where we are stuck.  HOW to access the macro variables.</description>
      <pubDate>Tue, 11 Aug 2020 19:06:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Setting-date-range-ProjectParameter-objects-in-a-SAS-EG/m-p/675981#M36696</guid>
      <dc:creator>saslover15</dc:creator>
      <dc:date>2020-08-11T19:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: Setting date range ProjectParameter objects in a SAS EG automation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Setting-date-range-ProjectParameter-objects-in-a-SAS-EG/m-p/676544#M36720</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/149110"&gt;@saslover15&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi Tom! Thanks! We will make sure about the quotes. Yes, parameters do become macro variables. This is VB.net code I posted. But HOW do we access the macro variables in the first place to be able to set their values before the SAS code run? That is where we are stuck. HOW to access the macro variables.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In EG the user is prompted to make a selection. If you read the thread you linked the best suggestion is to just write your code to use the same macro variable names as the EG prompt was generating.&amp;nbsp; And then just call the code via some easy to replicate process.&amp;nbsp; Like the Unix command line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Say it was generating these two macro variables.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date_min=01AUG2019;
%let date_max=01JAN2020;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then the code is normally written to just use the macro variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where somedate between "&amp;amp;date_min"d and "&amp;amp;date_max"d &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now if you wanted to make the same code work if instead the values are present in environment variables named date_min and date_max instead you could add at the top of the program:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if 0=%length(&amp;amp;date_min) and 0&amp;lt;%sysfunc(envlen(date_min)) %then %do;
  %let date_min=%sysget(date_min);
%end;
%if 0=%length(&amp;amp;date_max) and 0&amp;lt;%sysfunc(envlen(date_max)) %then %do;
  %let date_max=%sysget(date_max);
%end;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then if you are running the code via EG and the user has answered the prompts the macro variables are set.&amp;nbsp; But if you want to run it outside of EG you can just use the -set command line option to set the dates into the corresponding environment variables instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 16:44:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Setting-date-range-ProjectParameter-objects-in-a-SAS-EG/m-p/676544#M36720</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-13T16:44:17Z</dc:date>
    </item>
  </channel>
</rss>

