<?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 code the Minimum values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-the-Minimum-values/m-p/188026#M304130</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much, Patrick.&lt;/P&gt;&lt;P&gt;It works!&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Nov 2014 18:33:45 GMT</pubDate>
    <dc:creator>ursula</dc:creator>
    <dc:date>2014-11-26T18:33:45Z</dc:date>
    <item>
      <title>How to code the Minimum values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-the-Minimum-values/m-p/188023#M304127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have question of how to code in SAS&amp;nbsp; for the minimum values (amount) up to the index year for each ID. see below for the example:&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" height="260" style="width: 649px; height: 262px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" width="64"&gt;ID&lt;/TD&gt;&lt;TD class="xl65" width="64"&gt;year&lt;/TD&gt;&lt;TD class="xl65" width="80"&gt;amount&lt;/TD&gt;&lt;TD class="xl63" width="195"&gt;Minimum amount&lt;/TD&gt;&lt;TD class="xl63" width="102"&gt;&lt;STRONG&gt;Expected value&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;11&lt;/TD&gt;&lt;TD class="xl66"&gt;2001&lt;/TD&gt;&lt;TD class="xl66"&gt;100&lt;/TD&gt;&lt;TD class="xl64"&gt;Min(100) ---&amp;nbsp; year 2001&lt;/TD&gt;&lt;TD class="xl67"&gt;&lt;STRONG&gt;100&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;11&lt;/TD&gt;&lt;TD class="xl66"&gt;2002&lt;/TD&gt;&lt;TD class="xl66"&gt;25&lt;/TD&gt;&lt;TD class="xl64"&gt;Min(100,25)&amp;nbsp; -- year 2001 &amp;amp; 2002&lt;/TD&gt;&lt;TD class="xl67"&gt;&lt;STRONG&gt;25&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;11&lt;/TD&gt;&lt;TD class="xl66"&gt;2003&lt;/TD&gt;&lt;TD class="xl66"&gt;10&lt;/TD&gt;&lt;TD class="xl64"&gt;Min(100,25,10)&amp;nbsp; -- year 2001, 2002, 2003&lt;/TD&gt;&lt;TD class="xl67"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;11&lt;/TD&gt;&lt;TD class="xl66"&gt;2004&lt;/TD&gt;&lt;TD class="xl66"&gt;200&lt;/TD&gt;&lt;TD class="xl64"&gt;Min(100,25,10,200) &lt;/TD&gt;&lt;TD class="xl67"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;22&lt;/TD&gt;&lt;TD class="xl66"&gt;2002&lt;/TD&gt;&lt;TD class="xl66"&gt;50&lt;/TD&gt;&lt;TD class="xl64"&gt;Min(50)&lt;/TD&gt;&lt;TD class="xl67"&gt;&lt;STRONG&gt;50&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;22&lt;/TD&gt;&lt;TD class="xl66"&gt;2006&lt;/TD&gt;&lt;TD class="xl66"&gt;25&lt;/TD&gt;&lt;TD class="xl64"&gt;Min(50,25)&lt;/TD&gt;&lt;TD class="xl67"&gt;&lt;STRONG&gt;25&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;22&lt;/TD&gt;&lt;TD class="xl66"&gt;2007&lt;/TD&gt;&lt;TD class="xl66"&gt;200&lt;/TD&gt;&lt;TD class="xl64"&gt;Min(50,25,200)&lt;/TD&gt;&lt;TD class="xl67"&gt;&lt;STRONG&gt;25&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20"&gt;22&lt;/TD&gt;&lt;TD class="xl66"&gt;2008&lt;/TD&gt;&lt;TD class="xl66"&gt;300&lt;/TD&gt;&lt;TD class="xl64"&gt;Min(50,25,200,300)&lt;/TD&gt;&lt;TD class="xl67"&gt;&lt;STRONG&gt;25&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to code it in data statement in order to get the Expected value.&lt;/P&gt;&lt;P&gt;Thank you very much in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 18:16:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-the-Minimum-values/m-p/188023#M304127</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2014-11-26T18:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to code the Minimum values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-the-Minimum-values/m-p/188024#M304128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile datalines truncover dsd;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input ID&amp;nbsp; year&amp;nbsp; amount;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;11,2001,100&lt;/P&gt;&lt;P&gt;11,2002,25&lt;/P&gt;&lt;P&gt;11,2003,10&lt;/P&gt;&lt;P&gt;11,2004,200&lt;/P&gt;&lt;P&gt;22,2002,50&lt;/P&gt;&lt;P&gt;22,2006,25&lt;/P&gt;&lt;P&gt;22,2007,200&lt;/P&gt;&lt;P&gt;22,2008,300&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by id year;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain min_amt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.id then min_amt=amount;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else min_amt=min(min_amt, amount);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 18:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-the-Minimum-values/m-p/188024#M304128</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-11-26T18:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to code the Minimum values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-the-Minimum-values/m-p/188025#M304129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A Proc SQL alternative, no presort needed.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;infile&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;dlm&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'09'x&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; ID&amp;nbsp;&amp;nbsp; year amount;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;11&amp;nbsp;&amp;nbsp; 2001 100&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;11&amp;nbsp;&amp;nbsp; 2002 25&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;11&amp;nbsp;&amp;nbsp; 2003 10&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;11&amp;nbsp;&amp;nbsp; 2004 200&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;22&amp;nbsp;&amp;nbsp; 2002 50&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;22&amp;nbsp;&amp;nbsp; 2006 25&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;22&amp;nbsp;&amp;nbsp; 2007 200&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;22&amp;nbsp;&amp;nbsp; 2008 300&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;/*sql*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; want &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;as&lt;/SPAN&gt; &lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; *, (&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; min(amount) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; id=a.id &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; year &amp;lt;=a.year) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; Rolling_min&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have a;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 18:25:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-the-Minimum-values/m-p/188025#M304129</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-11-26T18:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to code the Minimum values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-the-Minimum-values/m-p/188026#M304130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much, Patrick.&lt;/P&gt;&lt;P&gt;It works!&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 18:33:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-the-Minimum-values/m-p/188026#M304130</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2014-11-26T18:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to code the Minimum values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-the-Minimum-values/m-p/188027#M304131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Hai Kuo.&lt;/P&gt;&lt;P&gt;This one using Proc sql also works!!&lt;/P&gt;&lt;P&gt;I'm not using Proc sql very much, but it's good to learn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wonder what does the "a" mean?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 18:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-the-Minimum-values/m-p/188027#M304131</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2014-11-26T18:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to code the Minimum values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-the-Minimum-values/m-p/188028#M304132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ursula,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is alias for have.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 19:10:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-the-Minimum-values/m-p/188028#M304132</guid>
      <dc:creator>kaushal2040</dc:creator>
      <dc:date>2014-11-26T19:10:43Z</dc:date>
    </item>
  </channel>
</rss>

