<?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: Use Min and Max dates in the title in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-Min-and-Max-dates-in-the-title/m-p/446975#M28911</link>
    <description>&lt;P&gt;Agreed! They do look more like Excel dates. But then&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/75899"&gt;@DME790&lt;/a&gt;&amp;nbsp;could use:&lt;/P&gt;
&lt;PRE&gt;Proc SQL;
  Select put(input(min(Date),comma8.)-21916,date9.),
         put(input(max(Date),comma8.)-21916,date9.)
    into :mindate, :maxdate   
      From Test
  ;
Quit;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Mar 2018 23:31:40 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2018-03-19T23:31:40Z</dc:date>
    <item>
      <title>Use Min and Max dates in the title</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-Min-and-Max-dates-in-the-title/m-p/446965#M28905</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to use the&amp;nbsp;Min and Max dates in the title of a report so people know what the date range is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used the Proc SQL to get the MIN and MAX dates. Is this the best method to use&amp;nbsp;- how do I now use those dates in a title for a proc report?&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;Data test;
	Input Date $ Count;
	Datalines;

42,921 4
42,922 1
 42,922 1
 42,922 1
 42,922 1
 42,922 1
 42,922 1
 42,922 1
 42,922 1
 42,926 1
 42,940 1
 42,940 3
 42,940 1
 42,940 1
 42,940 1
 42,941 1
 42,941 1
 42,941 1
 42,941 1
 42,941 1
 42,941 1
;
Run;


Proc SQL;
	Create table work.MinMaxDates AS
	Select min(Date) as mindate, max(Date) as maxdate 
		From Test;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc SUmmary data=test sum;
	By Date;
	VAR Count;
	Output out=testsum (DROP=_FREQ_ _TYPE_) SUM=;
RUN;

Title "&amp;amp;mindate to &amp;amp;Maxdate";

Proc Report data=Testsum;
	Column Date Count;
	Define Date / NOPRINT;
	Define Count / Display f=comma8.;
Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any help appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dean&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 23:04:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-Min-and-Max-dates-in-the-title/m-p/446965#M28905</guid>
      <dc:creator>DME790</dc:creator>
      <dc:date>2018-03-19T23:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Use Min and Max dates in the title</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-Min-and-Max-dates-in-the-title/m-p/446970#M28907</link>
      <description>&lt;P&gt;Since you have used the macro variables of dates in titles, the best way is to derive the macro variables by proc sql&lt;/P&gt;
&lt;P&gt;Hope it is what you are expecting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc SQL;
	Select min(Date) as mindate, max(Date) as maxdate into: mindate, :maxdate
		From Test;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Mar 2018 23:19:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-Min-and-Max-dates-in-the-title/m-p/446970#M28907</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2018-03-19T23:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Use Min and Max dates in the title</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-Min-and-Max-dates-in-the-title/m-p/446971#M28908</link>
      <description>&lt;P&gt;Put them into a macro using INTO: in PROC SQL&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc SQL;
	
	Select min(Date) , max(Date) INTO: mindate ,: Maxdate
		From Test;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now you can call these macros(&amp;amp;mindate, &amp;amp;maxdate) in your titles&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 23:22:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-Min-and-Max-dates-in-the-title/m-p/446971#M28908</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-03-19T23:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: Use Min and Max dates in the title</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-Min-and-Max-dates-in-the-title/m-p/446972#M28909</link>
      <description>&lt;P&gt;Since those look like SAS dates I think you might want something like:&lt;/P&gt;
&lt;PRE&gt;Proc SQL;
  Select put(input(min(Date),comma8.),date9.),
         put(input(max(Date),comma8.),date9.)
    into :mindate, :maxdate   
      From Test
  ;
Quit;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 23:23:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-Min-and-Max-dates-in-the-title/m-p/446972#M28909</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-03-19T23:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: Use Min and Max dates in the title</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-Min-and-Max-dates-in-the-title/m-p/446973#M28910</link>
      <description>&lt;P&gt;Note that MIN and MAX do not work as you might think with character values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only way I can see 42,921 as a date is if the values are the exported numeric values of a date from Excel and then imported as character. If that is the case then maybe:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Data test;
   informat date comma6.;
	Input Date  Count;
   sasdate = '01JAN1900'd + date;
   format sasdate date9.;
	Datalines;
42,921 4
42,922 1
 42,922 1
 42,922 1
 42,922 1
 42,922 1
 42,922 1
 42,922 1
 42,922 1
 42,926 1
 42,940 1
 42,940 3
 42,940 1
 42,940 1
 42,940 1
 42,941 1
 42,941 1
 42,941 1
 42,941 1
 42,941 1
 42,941 1
;
Run;



proc sql;
   select put(min(sasdate),date9.),put(max(sasdate),date9.) into :mindate, :maxdate
   from test
   ;
quit;

title "&amp;amp;mindate. to &amp;amp;maxdate.";
&lt;/PRE&gt;
&lt;P&gt;You may have to adjust the arithmetic for the sasdate variable as I'm too lazy to attempt to adjust such a value. If this is following your data at all I doubt if the sasdate value will be off by more than one day though. The key bit above is how to create a macro variable in sql, the into :macrovar , :macrovar2 and applying a desirable format to an actual SAS date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Prior to importing data in SAS from Excel you want to make sure that the column in Excel is set as having a valid date format for all values. Anything that creates "dates" like that is a flawed process at some point.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 23:23:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-Min-and-Max-dates-in-the-title/m-p/446973#M28910</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-19T23:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: Use Min and Max dates in the title</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-Min-and-Max-dates-in-the-title/m-p/446975#M28911</link>
      <description>&lt;P&gt;Agreed! They do look more like Excel dates. But then&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/75899"&gt;@DME790&lt;/a&gt;&amp;nbsp;could use:&lt;/P&gt;
&lt;PRE&gt;Proc SQL;
  Select put(input(min(Date),comma8.)-21916,date9.),
         put(input(max(Date),comma8.)-21916,date9.)
    into :mindate, :maxdate   
      From Test
  ;
Quit;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 23:31:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-Min-and-Max-dates-in-the-title/m-p/446975#M28911</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-03-19T23:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: Use Min and Max dates in the title</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-Min-and-Max-dates-in-the-title/m-p/446979#M28913</link>
      <description>&lt;P&gt;Thanks ballardw - works perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry about the confusion with the dates - I couldn't get the dates in properly in the test data so I used the numeric value instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data comes from SAS tables so the field is set to a date value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks heaps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dean&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 23:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Use-Min-and-Max-dates-in-the-title/m-p/446979#M28913</guid>
      <dc:creator>DME790</dc:creator>
      <dc:date>2018-03-19T23:45:34Z</dc:date>
    </item>
  </channel>
</rss>

