<?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: format date in proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/format-date-in-proc-sql/m-p/624863#M184118</link>
    <description>&lt;P&gt;Note that the expression (1996-09-18) evaluates to the number 1,969 which is the 23rd day of May 1965.&lt;/P&gt;
&lt;PRE&gt;100   data test;
101    x=1996-09-18;
102    put x=comma10. ' As Date=' x date9. ;
103   run;

x=1,969  As Date=23MAY1965
NOTE: The data set WORK.TEST has 1 observations and 1 variables.
&lt;/PRE&gt;</description>
    <pubDate>Fri, 14 Feb 2020 15:28:35 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-02-14T15:28:35Z</dc:date>
    <item>
      <title>format date in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-date-in-proc-sql/m-p/624798#M184093</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table Orders (OrderID num(8), CustomerID num(5) , OrderDate format =yyyymmdd10.);
insert into Orders values (10308, 2, 1996-09-18);
insert into Orders values (10309, 37, 1996-09-18);
insert into Orders values (10310, 77 ,1996-09-18);
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;30 proc sql;&lt;BR /&gt;31 create table Orders (OrderID num(8), CustomerID num(5) , OrderDate format&lt;BR /&gt;------&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;31 ! =yyyymmdd10.);&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: CHAR, CHARACTER, DATE, DEC,&lt;BR /&gt;DECIMAL, DOUBLE, FLOAT, INT, INTEGER, NUM, NUMERIC, REAL, SMALLINT,&lt;BR /&gt;VARCHAR.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;32 insert into Orders values (10308, 2, 1996-09-18);&lt;BR /&gt;ERROR: File WORK.ORDERS.DATA does not exist.&lt;BR /&gt;33 insert into Orders values (10309, 37, 1996-09-18);&lt;BR /&gt;ERROR: File WORK.ORDERS.DATA does not exist.&lt;BR /&gt;34 insert into Orders values (10310, 77 ,1996-09-18);&lt;BR /&gt;ERROR: File WORK.ORDERS.DATA does not exist.&lt;BR /&gt;35 quit;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.25 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2020 12:21:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-date-in-proc-sql/m-p/624798#M184093</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2020-02-14T12:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: format date in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-date-in-proc-sql/m-p/624799#M184094</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try this:&lt;/P&gt;
&lt;P&gt;- specify the data type for OrderDate -&amp;gt; num&lt;/P&gt;
&lt;P&gt;- correct the format : yymmdd10. instead of yyyymmdd10.&lt;/P&gt;
&lt;P&gt;- you can have just one statement to specify values. To use the 'values' clauses, please specify the column names in the correct order and in parenthesis just after the table name.&lt;/P&gt;
&lt;P&gt;- indicates to SAS that the values for OrderDate are SAS dates -&amp;gt; 'ddmonyyyy'd&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table Orders (OrderID num(8), CustomerID num(5) , OrderDate num format=yymmdd10.);
insert into Orders (OrderID, CustomerID, OrderDate)
	values (10308, 2, '18SEP1996'd)
	values (10309, 37, '18SEP1996'd)
	values (10310, 77 ,'18SEP1996'd);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2020 12:44:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-date-in-proc-sql/m-p/624799#M184094</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-14T12:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: format date in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-date-in-proc-sql/m-p/624863#M184118</link>
      <description>&lt;P&gt;Note that the expression (1996-09-18) evaluates to the number 1,969 which is the 23rd day of May 1965.&lt;/P&gt;
&lt;PRE&gt;100   data test;
101    x=1996-09-18;
102    put x=comma10. ' As Date=' x date9. ;
103   run;

x=1,969  As Date=23MAY1965
NOTE: The data set WORK.TEST has 1 observations and 1 variables.
&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Feb 2020 15:28:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-date-in-proc-sql/m-p/624863#M184118</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-14T15:28:35Z</dc:date>
    </item>
  </channel>
</rss>

