<?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: What's the most efficient  to get the minimum and the maximum value of a variable in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/What-s-the-most-efficient-to-get-the-minimum-and-the-maximum/m-p/766402#M39492</link>
    <description>&lt;P&gt;Can we see the entire code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How could this work anyway? There is no variable named&amp;nbsp;&lt;SPAN&gt;transaction_dt in data set &amp;amp;nsource.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Sep 2021 14:43:46 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-09-07T14:43:46Z</dc:date>
    <item>
      <title>What's the most efficient  to get the minimum and the maximum value of a variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/What-s-the-most-efficient-to-get-the-minimum-and-the-maximum/m-p/766398#M39491</link>
      <description>&lt;P&gt;Hello, I am using the following code into a macro function to get the libname, memname, data type and the modate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table &amp;amp;nsource. as&lt;BR /&gt;select libname,&lt;BR /&gt;memname,&lt;BR /&gt;memtype,&lt;BR /&gt;modate &lt;BR /&gt;from sashelp.vtable&lt;BR /&gt;where libname="&amp;amp;lbname."&lt;BR /&gt;and &amp;amp;enddate.&amp;gt;= datepart(modate)&amp;gt;= &amp;amp;startdate.;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I am getting a table gathering this information for each&amp;nbsp;&amp;amp;nsource.&amp;nbsp; Each table could contains about 30 observations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When those table are created, I could use the libname and the memname as well as a proc sql as below to get the min and max value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create table &amp;amp;nsource_memname as&lt;/P&gt;
&lt;P&gt;select min(transaction_dt) as mintransacdate,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;max(transaction_dt) as maxtransacdate,&lt;/P&gt;
&lt;P&gt;from &amp;amp;nsource;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;I wonder if there is a more efficient way to do that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 14:38:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/What-s-the-most-efficient-to-get-the-minimum-and-the-maximum/m-p/766398#M39491</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2021-09-07T14:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: What's the most efficient  to get the minimum and the maximum value of a variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/What-s-the-most-efficient-to-get-the-minimum-and-the-maximum/m-p/766402#M39492</link>
      <description>&lt;P&gt;Can we see the entire code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How could this work anyway? There is no variable named&amp;nbsp;&lt;SPAN&gt;transaction_dt in data set &amp;amp;nsource.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 14:43:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/What-s-the-most-efficient-to-get-the-minimum-and-the-maximum/m-p/766402#M39492</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-09-07T14:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: What's the most efficient  to get the minimum and the maximum value of a variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/What-s-the-most-efficient-to-get-the-minimum-and-the-maximum/m-p/766426#M39497</link>
      <description>PROC MEANS/SUMMARY are the most efficent.</description>
      <pubDate>Tue, 07 Sep 2021 16:06:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/What-s-the-most-efficient-to-get-the-minimum-and-the-maximum/m-p/766426#M39497</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-09-07T16:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: What's the most efficient  to get the minimum and the maximum value of a variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/What-s-the-most-efficient-to-get-the-minimum-and-the-maximum/m-p/766435#M39498</link>
      <description>&lt;P&gt;I might be tempted to try something along the lines of:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
   select catx('.',libname,Memname) into :memlist separated by ' '
   from sashelp.vtable
   where libname="&amp;amp;lbname."
      and memtype='DATA'
       and &amp;amp;enddate.&amp;gt;= datepart(modate)&amp;gt;= &amp;amp;startdate.;
quit;

data need;
   set &amp;amp;memlist. indsname=dsn;
   source=dsn;
run;

proc summary data=need nway;
   class source;
   var transaction_dt;
   output out=want (drop=_:) 
      min(transaction_dt)=mintransacdate
      max(transaction_dt)=maxtransacdate
   ;
run;
&lt;/PRE&gt;
&lt;P&gt;This creates one output data set with the source data set name as a variable.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 16:46:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/What-s-the-most-efficient-to-get-the-minimum-and-the-maximum/m-p/766435#M39498</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-09-07T16:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: What's the most efficient  to get the minimum and the maximum value of a variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/What-s-the-most-efficient-to-get-the-minimum-and-the-maximum/m-p/766448#M39499</link>
      <description>&lt;BR /&gt;It's awesome. Also, as I am not familiar with the set &amp;amp; memlist option. indsname = dsn; I will add a reference: &lt;A href="https://blogs.sas.com/content/iml/2015/08/03/indsname-option.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2015/08/03/indsname-option.html&lt;/A&gt;</description>
      <pubDate>Tue, 07 Sep 2021 18:14:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/What-s-the-most-efficient-to-get-the-minimum-and-the-maximum/m-p/766448#M39499</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2021-09-07T18:14:41Z</dc:date>
    </item>
  </channel>
</rss>

