<?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: How to filter a set using a macro variable in OPTMODEL in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-filter-a-set-using-a-macro-variable-in-OPTMODEL/m-p/506510#M2452</link>
    <description>&lt;P&gt;You may want to&amp;nbsp;subset the dataset before feeding it to OPTMODEL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data lesscars;&lt;/P&gt;&lt;P&gt;set cars;&lt;/P&gt;&lt;P&gt;keep &amp;amp;mylist;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc optmodel;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;</description>
    <pubDate>Mon, 22 Oct 2018 16:25:32 GMT</pubDate>
    <dc:creator>pink_poodle</dc:creator>
    <dc:date>2018-10-22T16:25:32Z</dc:date>
    <item>
      <title>How to filter a set using a macro variable in OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-filter-a-set-using-a-macro-variable-in-OPTMODEL/m-p/506314#M2451</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a fairly large set that includes names of cars I'd like to run my optimization over, call it 'SERIES' for the sake of conversation.&amp;nbsp;Here is a snapshot of how I define and read the '&lt;SPAN&gt;SERIES&lt;/SPAN&gt;' in&amp;nbsp;PROC OPTMODEL:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC OPTMODEL;
...
SET &amp;lt;STR&amp;gt; SERIES;&lt;BR /&gt;...&lt;BR /&gt;READ DATA OPT_DATA_SERIES&amp;nbsp;INTO SERIES = [SERIES];&lt;BR /&gt;...&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This 'SERIES' includes a large number of car names. What I'd like to do is to pick a subset of these (maybe with the help of macro variables)&amp;nbsp;and define couple of constraints that only needed to be applied to those subset.&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;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IMPVAR SUBSET_SPEND = SUM{I IN SERIES: I IN &amp;amp;MYSUBSET.} SERIES_SPEND[I];&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Q1. Is the following part &lt;FONT face="courier new,courier" color="#0000FF"&gt;&lt;STRONG&gt;{...&amp;nbsp; : I IN &amp;amp;MYSUBSET. }&lt;/STRONG&gt;&lt;/FONT&gt; correct way to do this?&lt;/P&gt;&lt;P&gt;Q2. I have seen something like &lt;FONT face="courier new,courier" color="#0000FF"&gt;&lt;STRONG&gt;{I IN /'MYSUBSET'/}&lt;/STRONG&gt;&lt;/FONT&gt;, but I have no idea what it means and how I can use this format?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate any words of wisdom anyone could share.&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>Sun, 21 Oct 2018 16:33:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-filter-a-set-using-a-macro-variable-in-OPTMODEL/m-p/506314#M2451</guid>
      <dc:creator>er7212</dc:creator>
      <dc:date>2018-10-21T16:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter a set using a macro variable in OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-filter-a-set-using-a-macro-variable-in-OPTMODEL/m-p/506510#M2452</link>
      <description>&lt;P&gt;You may want to&amp;nbsp;subset the dataset before feeding it to OPTMODEL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data lesscars;&lt;/P&gt;&lt;P&gt;set cars;&lt;/P&gt;&lt;P&gt;keep &amp;amp;mylist;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc optmodel;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 16:25:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-filter-a-set-using-a-macro-variable-in-OPTMODEL/m-p/506510#M2452</guid>
      <dc:creator>pink_poodle</dc:creator>
      <dc:date>2018-10-22T16:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter a set using a macro variable in OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-filter-a-set-using-a-macro-variable-in-OPTMODEL/m-p/506529#M2453</link>
      <description>&lt;P&gt;If you want to ignore all the other observations, you can use the DATA set WHERE= option in the READ DATA statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, if MYSUBSET is a subset of SERIES, you can avoid the logical condition and just do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SUM{I IN MYSUBSET}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The correct syntax depends on what &amp;amp;MYSUBSET. looks like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 16:43:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-filter-a-set-using-a-macro-variable-in-OPTMODEL/m-p/506529#M2453</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-10-22T16:43:27Z</dc:date>
    </item>
  </channel>
</rss>

