<?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: Date format from SQL To SAS in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Date-format-from-SQL-To-SAS/m-p/703348#M26009</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/338030"&gt;@Citrine10&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see when I do a max on the date it gives the issue.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The result of a MAX function is the raw value, SQL does not automatically apply the format of the source variable.&lt;/P&gt;
&lt;P&gt;See this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input dateval yymmdd10.;
format dateval yymmdd10.;
datalines;
2020-05-02
2020-07-13
;

proc sql;
select max(dateval) as dateval
from have
;
select max(dateval) as dateval format=yymmdd10.
from have
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;    dateval
   --------
      22109
              

     dateval
  ----------
  2020-07-13
&lt;/PRE&gt;</description>
    <pubDate>Thu, 03 Dec 2020 12:20:39 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-12-03T12:20:39Z</dc:date>
    <item>
      <title>Date format from SQL To SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format-from-SQL-To-SAS/m-p/703335#M26005</link>
      <description>&lt;P&gt;hi there&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i pull data from a SQL environment into SAS. There is a date field in the table which changes to a 5 digit numeric value. How can I get the date to display as dd/mm/yyyy?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 11:10:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format-from-SQL-To-SAS/m-p/703335#M26005</guid>
      <dc:creator>Citrine10</dc:creator>
      <dc:date>2020-12-03T11:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Date format from SQL To SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format-from-SQL-To-SAS/m-p/703339#M26006</link>
      <description>&lt;P&gt;Apply the DDMMYY10. format.&lt;/P&gt;
&lt;P&gt;SAS dates are counts of days, with 1960-01-01 being day zero. That translates to 5-digit integers for most of the dates you will work with.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 11:17:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format-from-SQL-To-SAS/m-p/703339#M26006</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-03T11:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: Date format from SQL To SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format-from-SQL-To-SAS/m-p/703344#M26007</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see when I do a max on the date it gives the issue.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 11:37:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format-from-SQL-To-SAS/m-p/703344#M26007</guid>
      <dc:creator>Citrine10</dc:creator>
      <dc:date>2020-12-03T11:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Date format from SQL To SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format-from-SQL-To-SAS/m-p/703345#M26008</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/338030"&gt;@Citrine10&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see when I do a max on the date it gives the issue.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have to apply a date format to any variables that might be a date, including the one extracted from the database via PROC SQL and any other date variables you create via a function.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 11:51:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format-from-SQL-To-SAS/m-p/703345#M26008</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-12-03T11:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: Date format from SQL To SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format-from-SQL-To-SAS/m-p/703348#M26009</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/338030"&gt;@Citrine10&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see when I do a max on the date it gives the issue.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The result of a MAX function is the raw value, SQL does not automatically apply the format of the source variable.&lt;/P&gt;
&lt;P&gt;See this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input dateval yymmdd10.;
format dateval yymmdd10.;
datalines;
2020-05-02
2020-07-13
;

proc sql;
select max(dateval) as dateval
from have
;
select max(dateval) as dateval format=yymmdd10.
from have
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;    dateval
   --------
      22109
              

     dateval
  ----------
  2020-07-13
&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Dec 2020 12:20:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format-from-SQL-To-SAS/m-p/703348#M26009</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-03T12:20:39Z</dc:date>
    </item>
  </channel>
</rss>

