<?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: Length in CREATE DATA in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Length-in-CREATE-DATA/m-p/316502#M1554</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt﻿&lt;/a&gt;. You have been very helpful. I've made a good progress in learning PROC OPTMODEL and credit goes to you for providing links and clarifying doubts with examples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Last question - Why do we need to write 1 in the following statement?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sum {c in customers: product[c] IN {'A', 'B'}} 1
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Can't we simple write (without 1) -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sum {c in customers: product[c] IN {'A', 'B'}}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I remember you provided the similar solution wherein you mentioned 1 before dividing by 3-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ceil(sum {c in customers: sales[c] &amp;gt; 50} 1 / 3)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 03 Dec 2016 17:39:58 GMT</pubDate>
    <dc:creator>Ujjawal</dc:creator>
    <dc:date>2016-12-03T17:39:58Z</dc:date>
    <item>
      <title>Length in CREATE DATA</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Length-in-CREATE-DATA/m-p/316340#M1549</link>
      <description>&lt;P&gt;Is there any way we can change length of the variable created with CREATE DATA statement? I have a text variable which is used as a key variable in PROC OPTMODEL but it gets truncated in the data which is created with CREATE DATA statement. I am new to PROC OPTMODEL. Could you also please give a example of how OR condition is used in constraint? For example, sum {c in customers} (product[c] IN ('A', 'B'))&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 18:25:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Length-in-CREATE-DATA/m-p/316340#M1549</guid>
      <dc:creator>Ujjawal</dc:creator>
      <dc:date>2016-12-02T18:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: Length in CREATE DATA</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Length-in-CREATE-DATA/m-p/316352#M1550</link>
      <description>&lt;P&gt;The CREATE DATA statement has a LENGTH= option:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://go.documentation.sas.com/#!/?docsetId=ormpug&amp;amp;docsetVersion=14.2&amp;amp;docsetTarget=ormpug_optmodel_syntax11.htm&amp;amp;locale=en#ormpug.optmodel.npxcreatestmt" target="_blank"&gt;http://go.documentation.sas.com/#!/?docsetId=ormpug&amp;amp;docsetVersion=14.2&amp;amp;docsetTarget=ormpug_optmodel_syntax11.htm&amp;amp;locale=en#ormpug.optmodel.npxcreatestmt&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Correct syntax for your sum is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sum {c in customers: product[c] IN {'A', 'B'}}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For new users of PROC OPTMODEL, I recommend&amp;nbsp;&lt;A href="http://go.documentation.sas.com/#!/?docsetId=ormpex&amp;amp;docsetVersion=14.2&amp;amp;docsetTarget=titlepage.htm&amp;amp;locale=en" target="_self"&gt;this book of examples.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 18:58:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Length-in-CREATE-DATA/m-p/316352#M1550</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2016-12-02T18:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: Length in CREATE DATA</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Length-in-CREATE-DATA/m-p/316492#M1552</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt﻿&lt;/a&gt;&amp;nbsp;for your reply. Very much appreciated!&lt;BR /&gt;&lt;BR /&gt;Is sum {c in customers: product[c] IN {'A', 'B'}} equivalent to&amp;nbsp;&lt;SPAN&gt; sum {c in customers} (product[c] IN {'A', 'B'})? I get confused with '&lt;STRONG&gt;:'&lt;/STRONG&gt; symbol. Does it represent AND condition? Many times i see ':' is not required to apply AND condition.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2016 14:55:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Length-in-CREATE-DATA/m-p/316492#M1552</guid>
      <dc:creator>Ujjawal</dc:creator>
      <dc:date>2016-12-03T14:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: Length in CREATE DATA</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Length-in-CREATE-DATA/m-p/316498#M1553</link>
      <description>&lt;P&gt;The colon : operator (which you can think of as "such that") allows you to select a subset based on a logical expression:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://go.documentation.sas.com/#!/?docsetId=ormpug&amp;amp;docsetVersion=14.2&amp;amp;docsetTarget=ormpug_optmodel_details63.htm&amp;amp;locale=en" target="_blank"&gt;http://go.documentation.sas.com/#!/?docsetId=ormpug&amp;amp;docsetVersion=14.2&amp;amp;docsetTarget=ormpug_optmodel_details63.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following expressions are all equivalent and count the number of customers whose product is A or B:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sum {c in customers} (product[c] IN {'A', 'B'})
sum {c in customers} (if product[c] IN {'A', 'B'} then 1 else 0)
sum {c in customers} (if product[c] IN {'A', 'B'} then 1)
sum {c in customers: product[c] IN {'A', 'B'}} 1
card({c in customers: product[c] IN {'A', 'B'})&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See also my reply here, which is similar:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Mathematical-Optimization/Optimize-Traveling-Distance/td-p/308817/page/2" target="_blank"&gt;https://communities.sas.com/t5/Mathematical-Optimization/Optimize-Traveling-Distance/td-p/308817/page/2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2016 16:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Length-in-CREATE-DATA/m-p/316498#M1553</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2016-12-03T16:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Length in CREATE DATA</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Length-in-CREATE-DATA/m-p/316502#M1554</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt﻿&lt;/a&gt;. You have been very helpful. I've made a good progress in learning PROC OPTMODEL and credit goes to you for providing links and clarifying doubts with examples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Last question - Why do we need to write 1 in the following statement?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sum {c in customers: product[c] IN {'A', 'B'}} 1
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Can't we simple write (without 1) -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sum {c in customers: product[c] IN {'A', 'B'}}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I remember you provided the similar solution wherein you mentioned 1 before dividing by 3-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ceil(sum {c in customers: sales[c] &amp;gt; 50} 1 / 3)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2016 17:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Length-in-CREATE-DATA/m-p/316502#M1554</guid>
      <dc:creator>Ujjawal</dc:creator>
      <dc:date>2016-12-03T17:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Length in CREATE DATA</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Length-in-CREATE-DATA/m-p/316518#M1555</link>
      <description>Glad to help.  The 1 is there because the SUM operator requires a summand.</description>
      <pubDate>Sat, 03 Dec 2016 21:11:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Length-in-CREATE-DATA/m-p/316518#M1555</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2016-12-03T21:11:37Z</dc:date>
    </item>
  </channel>
</rss>

