<?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 Why SAS Convert different Numeric_type dates to 1960-01-01. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Why-SAS-Convert-different-Numeric-type-dates-to-1960-01-01/m-p/765935#M30595</link>
    <description>&lt;P&gt;Hi Mates,&lt;/P&gt;&lt;P&gt;I am trying to convert numeric date type column to&amp;nbsp;YYMMDDD10.&amp;nbsp; format using datepart. But when I try this command, it always give me the value of " 1960-01-01" which is not the correct date. I just wonder if&amp;nbsp;you can help me figuring out what wrong with it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the data:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="phongpham_0-1630702920503.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63284iBF834FD04724B65A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="phongpham_0-1630702920503.png" alt="phongpham_0-1630702920503.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and here is the code:&lt;/P&gt;&lt;PRE&gt;proc sql; /* why I can't convert date1 to correct date */
	create table z_raw_final as
		select date1, datepart(date1) 			as d_mth format YYMMDDD10.  
				, n_quarter
				, gdp_base
				, retail_sales_base 	as rto_base 
				, ICR_base
				, business_credit_base 	as bcg_base
		from z_raw1
		 	where n_quarter &amp;gt; -41 and n_quarter &amp;lt;= 20  ;
	quit;&lt;/PRE&gt;&lt;P&gt;I also try another way that I found in this forum but just get NULL values&lt;/P&gt;&lt;PRE&gt;data z_raw_final;
set z_raw_final;
format date1 datetime20.;
run;&lt;/PRE&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Phong Pham&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Sep 2021 21:06:56 GMT</pubDate>
    <dc:creator>phongpham</dc:creator>
    <dc:date>2021-09-03T21:06:56Z</dc:date>
    <item>
      <title>Why SAS Convert different Numeric_type dates to 1960-01-01.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Why-SAS-Convert-different-Numeric-type-dates-to-1960-01-01/m-p/765935#M30595</link>
      <description>&lt;P&gt;Hi Mates,&lt;/P&gt;&lt;P&gt;I am trying to convert numeric date type column to&amp;nbsp;YYMMDDD10.&amp;nbsp; format using datepart. But when I try this command, it always give me the value of " 1960-01-01" which is not the correct date. I just wonder if&amp;nbsp;you can help me figuring out what wrong with it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the data:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="phongpham_0-1630702920503.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63284iBF834FD04724B65A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="phongpham_0-1630702920503.png" alt="phongpham_0-1630702920503.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and here is the code:&lt;/P&gt;&lt;PRE&gt;proc sql; /* why I can't convert date1 to correct date */
	create table z_raw_final as
		select date1, datepart(date1) 			as d_mth format YYMMDDD10.  
				, n_quarter
				, gdp_base
				, retail_sales_base 	as rto_base 
				, ICR_base
				, business_credit_base 	as bcg_base
		from z_raw1
		 	where n_quarter &amp;gt; -41 and n_quarter &amp;lt;= 20  ;
	quit;&lt;/PRE&gt;&lt;P&gt;I also try another way that I found in this forum but just get NULL values&lt;/P&gt;&lt;PRE&gt;data z_raw_final;
set z_raw_final;
format date1 datetime20.;
run;&lt;/PRE&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Phong Pham&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 21:06:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Why-SAS-Convert-different-Numeric-type-dates-to-1960-01-01/m-p/765935#M30595</guid>
      <dc:creator>phongpham</dc:creator>
      <dc:date>2021-09-03T21:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why SAS Convert different Numeric_type dates to 1960-01-01.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Why-SAS-Convert-different-Numeric-type-dates-to-1960-01-01/m-p/765938#M30596</link>
      <description>&lt;P&gt;Excel dates need to be converted to SAS dates via the method shown here: &lt;A href="https://communities.sas.com/t5/New-SAS-User/Numeric-dates-not-converted-to-dates-properly/m-p/708873" target="_blank"&gt;https://communities.sas.com/t5/New-SAS-User/Numeric-dates-not-converted-to-dates-properly/m-p/708873&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, DATEPART() is not needed once you do the above conversion.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 21:19:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Why-SAS-Convert-different-Numeric-type-dates-to-1960-01-01/m-p/765938#M30596</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-09-03T21:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why SAS Convert different Numeric_type dates to 1960-01-01.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Why-SAS-Convert-different-Numeric-type-dates-to-1960-01-01/m-p/765955#M30604</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;. I understand now. Just fixed my code and it works well. Very much appreciate your help. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 22:20:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Why-SAS-Convert-different-Numeric-type-dates-to-1960-01-01/m-p/765955#M30604</guid>
      <dc:creator>phongpham</dc:creator>
      <dc:date>2021-09-03T22:20:21Z</dc:date>
    </item>
  </channel>
</rss>

