<?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: SAS Studio: How to convert Convert Char(13) to date in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/SAS-Studio-How-to-convert-Convert-Char-13-to-date/m-p/640764#M21758</link>
    <description>Thanks for your advise. I did it but is taking to long because the table as more than 12 gigs... 12 million of rowns...&lt;BR /&gt;&lt;BR /&gt;Actually, I want to check how many duplicated values are in the table for one specifique date. for example:&lt;BR /&gt;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;SELECT CLNCLI AS C_NDC, COUNT(*) AS NR_REGISTOS&lt;BR /&gt;FROM TRS_MKT.TRS_GBCLI_ACTIVO_INACTIVO&lt;BR /&gt;WHERE INPUT(SCAN(DT_REFERENCIA,1,''),yymmdd10.)='31dec2019'd /* Here I want to convert the date because the date in on forma '2019-12-31 00'*/&lt;BR /&gt;GROUP BY CLNCLI ORDER BY 2 DESC;&lt;BR /&gt;QUIT;&lt;BR /&gt;It is not working &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;</description>
    <pubDate>Fri, 17 Apr 2020 15:16:13 GMT</pubDate>
    <dc:creator>Romeo1</dc:creator>
    <dc:date>2020-04-17T15:16:13Z</dc:date>
    <item>
      <title>SAS Studio: How to convert Convert Char(13) to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Studio-How-to-convert-Convert-Char-13-to-date/m-p/640720#M21755</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could you kinldy help to convert&amp;nbsp;Char(13) to date. The data char(13) is '2019-12-31 00' and I want to convert it do date. Another thing is that I want to select all information from one table and indicate that I only want 31 Dec 2019. This convertion i will use in the qery bellow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table teste_dmk as select dt_referencia,&lt;BR /&gt;gbncli &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;as c_ndc,&lt;BR /&gt;gbncli_activo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; as c_ind_activo&lt;BR /&gt;from trs_mkt.trs_gbcli_activo_inactivo&lt;/P&gt;&lt;P&gt;where dt_referencia=31122019; HERE I NEED HELP.&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 13:28:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Studio-How-to-convert-Convert-Char-13-to-date/m-p/640720#M21755</guid>
      <dc:creator>Romeo1</dc:creator>
      <dc:date>2020-04-17T13:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Studio: How to convert Convert Char(13) to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Studio-How-to-convert-Convert-Char-13-to-date/m-p/640724#M21756</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/215749"&gt;@Romeo1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the conversion into date, you can use the input() function with the proper informat:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	format want date9.;
	have = '2019-12-31 00';
	want = input(substr(have,1,10), YYMMDD10.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the query, you can specify&amp;nbsp;&lt;CODE class=" language-sas"&gt;"31DEC2019"d&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table teste_dmk as select dt_referencia,
gbncli                            as c_ndc,
gbncli_activo                 as c_ind_activo
from trs_mkt.trs_gbcli_activo_inactivo
where dt_referencia="31DEC2019"d;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Apr 2020 13:36:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Studio-How-to-convert-Convert-Char-13-to-date/m-p/640724#M21756</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-04-17T13:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Studio: How to convert Convert Char(13) to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Studio-How-to-convert-Convert-Char-13-to-date/m-p/640728#M21757</link>
      <description>&lt;P&gt;you can try below code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table teste_dmk as select input(scan(dt_referencia,1,' '),yymmdd10.) as dt_referencia2,
gbncli                            as c_ndc,
gbncli_activo                 as c_ind_activo
from trs_mkt.trs_gbcli_activo_inactivo
having dt_referencia2='31dec2019'd; 
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Apr 2020 13:46:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Studio-How-to-convert-Convert-Char-13-to-date/m-p/640728#M21757</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2020-04-17T13:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Studio: How to convert Convert Char(13) to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Studio-How-to-convert-Convert-Char-13-to-date/m-p/640764#M21758</link>
      <description>Thanks for your advise. I did it but is taking to long because the table as more than 12 gigs... 12 million of rowns...&lt;BR /&gt;&lt;BR /&gt;Actually, I want to check how many duplicated values are in the table for one specifique date. for example:&lt;BR /&gt;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;SELECT CLNCLI AS C_NDC, COUNT(*) AS NR_REGISTOS&lt;BR /&gt;FROM TRS_MKT.TRS_GBCLI_ACTIVO_INACTIVO&lt;BR /&gt;WHERE INPUT(SCAN(DT_REFERENCIA,1,''),yymmdd10.)='31dec2019'd /* Here I want to convert the date because the date in on forma '2019-12-31 00'*/&lt;BR /&gt;GROUP BY CLNCLI ORDER BY 2 DESC;&lt;BR /&gt;QUIT;&lt;BR /&gt;It is not working &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;</description>
      <pubDate>Fri, 17 Apr 2020 15:16:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Studio-How-to-convert-Convert-Char-13-to-date/m-p/640764#M21758</guid>
      <dc:creator>Romeo1</dc:creator>
      <dc:date>2020-04-17T15:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Studio: How to convert Convert Char(13) to date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Studio-How-to-convert-Convert-Char-13-to-date/m-p/640777#M21759</link>
      <description>&lt;P&gt;What is actually in the data?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First are you sure it is character and not a date (or datetime) value that is just being displayed using that year month day ordered string?&lt;/P&gt;
&lt;P&gt;Why are you using the SCAN function?&amp;nbsp; If you specify a width in the informat specification then only the first 10 characters will be used.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;INPUT(DT_REFERENCIA,yymmdd10.)='31dec2019'd &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And perhaps most important if you just want to the one value then why convert it to an actual date at all?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DT_REFERENCIA like '2019-12-31%'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is the libref&amp;nbsp;&lt;SPAN&gt;TRS_MKT pointing at some external database system? Perhaps SAS is unable to convert your code to run in the database and is pulling the whole database across ot SAS and then summarizing. Try writing an explicit passthru query.&amp;nbsp; Note that means you need to use the remote database's version of SQL.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
connect using TRS_MKT;
select * from connection to TRS_MKT
(SELECT CLNCLI AS C_NDC, COUNT(*) AS NR_REGISTOS
  FROM TRS_GBCLI_ACTIVO_INACTIVO
  where DT_REFERENCIA like '2019-12-31%'
  group by CLNCLI 
)
ORDER BY 2 DESC
;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Apr 2020 16:49:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Studio-How-to-convert-Convert-Char-13-to-date/m-p/640777#M21759</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-17T16:49:27Z</dc:date>
    </item>
  </channel>
</rss>

