<?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 a Macro to an EG Parameter in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-a-Macro-to-an-EG-Parameter/m-p/70490#M7048</link>
    <description>Sure, I've created Date parameters from EG many times. The value you choose from the prompt will be returned to code as if you typed:&lt;BR /&gt;
&lt;BR /&gt;
'01Jan1952'd&lt;BR /&gt;
&lt;BR /&gt;
for example. So, quotes and the "d" built in, for better or worse.&lt;BR /&gt;
&lt;BR /&gt;
1. In the Parameters Manager, create your parameter StartTime with a data type of Date. Always best to set a default date, check Prompt for Value and check A Value is Required at Runtime.&lt;BR /&gt;
&lt;BR /&gt;
2. Right click on the Code Node or Task with the parameter reference and choose Properties. From the Parameters tab, add the parameter(s) in question so they're associated with the code or task.&lt;BR /&gt;
&lt;BR /&gt;
3. In the code itself, make sure you write it like&lt;BR /&gt;
&lt;BR /&gt;
where datepart(Market_Start_Time) &amp;gt;= &amp;amp;StartTime&lt;BR /&gt;
&lt;BR /&gt;
keeping in mind how EG returns that parameter value as above.</description>
    <pubDate>Wed, 21 Jan 2009 21:09:48 GMT</pubDate>
    <dc:creator>RichardH_sas</dc:creator>
    <dc:date>2009-01-21T21:09:48Z</dc:date>
    <item>
      <title>Assign a Macro to an EG Parameter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-a-Macro-to-an-EG-Parameter/m-p/70487#M7045</link>
      <description>Is there a way to assign a macro to an existing Parameter in EG so that it prompts the user for a date range?  I have the parameter set in EG but not sure how to go about this or if it is even possible.  I need to be able to edit the following code for a prompt screen.&lt;BR /&gt;
&lt;BR /&gt;
I have the following code:&lt;BR /&gt;
&lt;BR /&gt;
%let DayLightSaveTime_Hours = 7;&lt;BR /&gt;
&lt;BR /&gt;
%let StartTime = %str('20DEC2008');&lt;BR /&gt;
%let EndTime = %str('21DEC2008');&lt;BR /&gt;
&lt;BR /&gt;
data WORK.input_market;&lt;BR /&gt;
	set IFM.market;&lt;BR /&gt;
	where datepart(Market_Start_Time) &amp;gt;= &amp;amp;StartTime.d&lt;BR /&gt;
	and datepart(Market_End_Time) &amp;lt;= &amp;amp;EndTime.d;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Thanks!&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: BS_CISO

Message was edited by: BS_CISO</description>
      <pubDate>Tue, 20 Jan 2009 23:19:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-a-Macro-to-an-EG-Parameter/m-p/70487#M7045</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-01-20T23:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: Assign a Macro to an EG Parameter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-a-Macro-to-an-EG-Parameter/m-p/70488#M7046</link>
      <description>For some reason the code won't post completely.  There is a "Endtime.d" and a "run;" following the above code.</description>
      <pubDate>Tue, 20 Jan 2009 23:30:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-a-Macro-to-an-EG-Parameter/m-p/70488#M7046</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-01-20T23:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Assign a Macro to an EG Parameter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-a-Macro-to-an-EG-Parameter/m-p/70489#M7047</link>
      <description>Hi:&lt;BR /&gt;
  It is generally a bad idea to "prequote" your macro variable values in the %LET statement. The quotes belong to the WHERE clause...&lt;BR /&gt;
this is perfectly valid SAS code:&lt;BR /&gt;
                                 &lt;BR /&gt;
[pre]&lt;BR /&gt;
where birthday = "15Nov1950"d;&lt;BR /&gt;
                                  &lt;BR /&gt;
%let bday = 15Nov1950;&lt;BR /&gt;
where birthday = "&amp;amp;bday"d;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                                                               &lt;BR /&gt;
the quotes around your date constant can be either single or double quotes. Putting the quotes, where they belong, in the WHERE statement or &lt;BR /&gt;
clause, allows you to avoid "pre-quoting", using %str and possibly needing %unquote to undo the effects of %str.&lt;BR /&gt;
&lt;BR /&gt;
I don't work with EG that much, so will defer to EG users on how to assign a macro variable a value with a parameter. But I believe that these &lt;BR /&gt;
general rules for macro processing still hold:&lt;BR /&gt;
1) have working code and put quotes in the working code where needed&lt;BR /&gt;
2) DO NOT put quotes in your %LET statement&lt;BR /&gt;
3) Once you have working code, replace the hardcoded values with macro variable references and test the code again&lt;BR /&gt;
4) If you need macro conditional logic, take your macro-ized code and put it into a macro program for invocation.&lt;BR /&gt;
5) Use only the "strength" of macro quoting function that you need. For example, if you need to prevent resolution of a macro variable at compile time, &lt;BR /&gt;
don't use an execution time quoting function and vice versa. Do not use macro quoting functions unless you REALLY need them.&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 21 Jan 2009 01:27:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-a-Macro-to-an-EG-Parameter/m-p/70489#M7047</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-01-21T01:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Assign a Macro to an EG Parameter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-a-Macro-to-an-EG-Parameter/m-p/70490#M7048</link>
      <description>Sure, I've created Date parameters from EG many times. The value you choose from the prompt will be returned to code as if you typed:&lt;BR /&gt;
&lt;BR /&gt;
'01Jan1952'd&lt;BR /&gt;
&lt;BR /&gt;
for example. So, quotes and the "d" built in, for better or worse.&lt;BR /&gt;
&lt;BR /&gt;
1. In the Parameters Manager, create your parameter StartTime with a data type of Date. Always best to set a default date, check Prompt for Value and check A Value is Required at Runtime.&lt;BR /&gt;
&lt;BR /&gt;
2. Right click on the Code Node or Task with the parameter reference and choose Properties. From the Parameters tab, add the parameter(s) in question so they're associated with the code or task.&lt;BR /&gt;
&lt;BR /&gt;
3. In the code itself, make sure you write it like&lt;BR /&gt;
&lt;BR /&gt;
where datepart(Market_Start_Time) &amp;gt;= &amp;amp;StartTime&lt;BR /&gt;
&lt;BR /&gt;
keeping in mind how EG returns that parameter value as above.</description>
      <pubDate>Wed, 21 Jan 2009 21:09:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-a-Macro-to-an-EG-Parameter/m-p/70490#M7048</guid>
      <dc:creator>RichardH_sas</dc:creator>
      <dc:date>2009-01-21T21:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: Assign a Macro to an EG Parameter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-a-Macro-to-an-EG-Parameter/m-p/70491#M7049</link>
      <description>Thanks for the responses.&lt;BR /&gt;
&lt;BR /&gt;
Richard, perfect, exactly what I was trying to do, thank you.</description>
      <pubDate>Thu, 22 Jan 2009 21:34:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Assign-a-Macro-to-an-EG-Parameter/m-p/70491#M7049</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-01-22T21:34:18Z</dc:date>
    </item>
  </channel>
</rss>

