<?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: how to convert a datetime to date in snowflake in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-convert-a-datetime-to-date-in-snowflake/m-p/908936#M44081</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76331"&gt;@alepage&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if you are trying to pass this value over to Snowflake and use it there, then you may want to look at this SAS/ACCESS Interface to Snowflake&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/v_046/acreldb/n1d5j8d7wegfezn1irjj3hcrne1n.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/v_046/acreldb/n1d5j8d7wegfezn1irjj3hcrne1n.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps&lt;/P&gt;</description>
    <pubDate>Tue, 19 Dec 2023 21:35:01 GMT</pubDate>
    <dc:creator>AhmedAl_Attar</dc:creator>
    <dc:date>2023-12-19T21:35:01Z</dc:date>
    <item>
      <title>how to convert a datetime to date in snowflake</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-convert-a-datetime-to-date-in-snowflake/m-p/908929#M44079</link>
      <description>&lt;P&gt;Hello, I would like to convert a datetime and take the datepart in snowflake. The datepart(AUTHRSTN_DT) is not working.&lt;/P&gt;
&lt;P&gt;How to do that?&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;AUTHRSTN_DT
05JUN2023:08:24:37.000000

Please note that AUTHRSTN_DT format is datetime25.6

authorisation_date=datepart(AUTHRSTN_DT);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 21:06:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-convert-a-datetime-to-date-in-snowflake/m-p/908929#M44079</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-12-19T21:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert a datetime to date in snowflake</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-convert-a-datetime-to-date-in-snowflake/m-p/908934#M44080</link>
      <description>&lt;P&gt;If it's coming over as a legit datetime value into SAS it should work. However, if it's coming over as character then you'll have to convert it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data g;
 AUTHRSTN_DT = '05JUN2023:08:24:37.000000';
 AUTHRSTN_DT_N = input(AUTHRSTN_DT ,datetime25.6);
 justDate = datepart(AUTHRSTN_DT_N );
 format justDate date9.;
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If using SAS/ACCESS to Snowflake libname, then &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/n0v4ma1zb9lu99n1728j279rjcqi.htm" target="_self"&gt;you might need to use the DBSASTYPE option&lt;/A&gt; on the libname statement to ensure the column is treated as a SAS datetime.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 21:29:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-convert-a-datetime-to-date-in-snowflake/m-p/908934#M44080</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2023-12-19T21:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert a datetime to date in snowflake</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-convert-a-datetime-to-date-in-snowflake/m-p/908936#M44081</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76331"&gt;@alepage&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if you are trying to pass this value over to Snowflake and use it there, then you may want to look at this SAS/ACCESS Interface to Snowflake&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/v_046/acreldb/n1d5j8d7wegfezn1irjj3hcrne1n.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/v_046/acreldb/n1d5j8d7wegfezn1irjj3hcrne1n.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 21:35:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-convert-a-datetime-to-date-in-snowflake/m-p/908936#M44081</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2023-12-19T21:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert a datetime to date in snowflake</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-convert-a-datetime-to-date-in-snowflake/m-p/908942#M44083</link>
      <description>&lt;P&gt;Why not ask SNOWFLAKE?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.snowflake.com/en/sql-reference/functions/to_date" target="_blank"&gt;https://docs.snowflake.com/en/sql-reference/functions/to_date&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 22:06:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-convert-a-datetime-to-date-in-snowflake/m-p/908942#M44083</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-12-19T22:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert a datetime to date in snowflake</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-convert-a-datetime-to-date-in-snowflake/m-p/908943#M44084</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76331"&gt;@alepage&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello, I would like to convert a datetime and take the datepart in snowflake. The datepart(AUTHRSTN_DT) is not working.&lt;/P&gt;
&lt;P&gt;How to do that?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;To do what? To load a SAS table into Snowflake or to use it in a where clause to query Snowflake?&lt;/P&gt;
&lt;P&gt;If query: If you run Proc Contents against the Snowflake table what type and format does the column show?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What's not working with datepart()? You get an error, or an undesired result, or the query just runs forever?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's for a query formulated in SAS SQL, the column in Snowflake is of type DateTime and you want all rows matching a specific date then below query should work and also get pushed to the DB for execution&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where '05JUN2023:00:00:00'dt &amp;lt;= AUTHRSTN_DT &amp;lt; '06JUN2023:00:00:00'dt&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 22:38:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-convert-a-datetime-to-date-in-snowflake/m-p/908943#M44084</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-12-19T22:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert a datetime to date in snowflake</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-convert-a-datetime-to-date-in-snowflake/m-p/908944#M44085</link>
      <description />
      <pubDate>Tue, 19 Dec 2023 23:06:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-convert-a-datetime-to-date-in-snowflake/m-p/908944#M44085</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-12-19T23:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert a datetime to date in snowflake</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-convert-a-datetime-to-date-in-snowflake/m-p/908945#M44086</link>
      <description>&lt;P&gt;What's the value of&amp;nbsp;&amp;amp;accountingDate?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What happens if you run below? Do you get any&amp;nbsp;eodreport_date with a select_flg=0 that you would have wanted to select?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  set inforce_auto_cntrctver_org;
  if eodreport_date &amp;lt;= &amp;amp;accountingdate. then select_flg=1;
  else select_flg=0;
run;

proc freq data=test;
  table eodreport_date*select_flg /nocol norow nopercent;;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 22:52:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-convert-a-datetime-to-date-in-snowflake/m-p/908945#M44086</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-12-19T22:52:47Z</dc:date>
    </item>
  </channel>
</rss>

