<?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: conver datetime to numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904686#M357410</link>
    <description>&lt;P&gt;The request doesn't make much sense.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You appear to be starting with a DATETIME value, which is already a NUMBER.&amp;nbsp; The number of seconds since start of 1960.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So what is it you want to produce?&lt;/P&gt;</description>
    <pubDate>Mon, 27 Nov 2023 18:31:18 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-11-27T18:31:18Z</dc:date>
    <item>
      <title>conver datetime to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904678#M357404</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I can change the standard dt to a number&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let DTCut = "18&amp;amp;M8.2022:23:59:59"dt;
%put DTCut = %sysfunc(inputn(&amp;amp;DTCut.,anydtdtm.));&lt;/PRE&gt;
&lt;P&gt;but I can't handle it&lt;/P&gt;
&lt;PRE&gt;proc format;	picture DTCustom other = '%Y-%0m-%0d-%0H-%0M-%0S' (datatype = datetime);	run;

%let DTCut = "2022-08-18-23-59-59";&lt;/PRE&gt;
&lt;P&gt;Thank you for your answer.&lt;/P&gt;
&lt;P&gt;Best regards.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2023 17:59:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904678#M357404</guid>
      <dc:creator>makset</dc:creator>
      <dc:date>2023-11-27T17:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: conver datetime to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904680#M357406</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17744"&gt;@makset&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can change the standard dt to a number&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let DTCut = "18&amp;amp;M8.2022:23:59:59"dt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't think anyone knows what macro variable &amp;amp;M8 is and without that we can't help you.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;In addition, its not clear to me the desired output (or even the inputs) are that you are struggling with. Please explain the problem in more detail.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2023 18:09:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904680#M357406</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-27T18:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: conver datetime to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904683#M357407</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17744"&gt;@makset&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can change the standard dt to a number&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let DTCut = "18&amp;amp;M8.2022:23:59:59"dt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't think anyone knows what macro variable &amp;amp;M8 is and without that we can't help you.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;In addition, its not clear to me the desired output (or even the inputs) are that you are struggling with. Please explain the problem in more detail.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;%let M1 = jan; %let M2 = feb; %let M3 = mar; %let M4 = apr; %let M5 = may; %let M6 = jun; %let M7 = jul; %let M8 = aug; %let M9 = sep; %let M10 = oct; %let M11 = nov; %let M12 = dec;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sorry, I didn't notice that&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2023 18:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904683#M357407</guid>
      <dc:creator>makset</dc:creator>
      <dc:date>2023-11-27T18:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: conver datetime to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904684#M357408</link>
      <description>DTCut = 1976486399&lt;BR /&gt;</description>
      <pubDate>Mon, 27 Nov 2023 18:24:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904684#M357408</guid>
      <dc:creator>makset</dc:creator>
      <dc:date>2023-11-27T18:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: conver datetime to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904685#M357409</link>
      <description>&lt;P&gt;Is this what you want to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    picture DTCustom other = '%Y-%0m-%0d-%0H-%0M-%0S' (datatype = datetime);	
run;

%let m8=Aug;
%let dtcut = %sysevalf("18&amp;amp;m8.2022:23:59:59"dt);
%put &amp;amp;=dtcut;

%let dtcut1= %sysfunc(putn(&amp;amp;dtCut,dtcustom.));
%put &amp;amp;=dtcut1;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Nov 2023 18:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904685#M357409</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-27T18:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: conver datetime to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904686#M357410</link>
      <description>&lt;P&gt;The request doesn't make much sense.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You appear to be starting with a DATETIME value, which is already a NUMBER.&amp;nbsp; The number of seconds since start of 1960.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So what is it you want to produce?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2023 18:31:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904686#M357410</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-11-27T18:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: conver datetime to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904687#M357411</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have it"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let DTCut = "2022-08-18-23-59-59";&lt;BR /&gt;or&amp;nbsp;&lt;BR /&gt;%let DTCut = "2022-08-18-23-59-59"dt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I want this:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;DTCut = 1976486399&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;sorry for the confusion&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2023 18:37:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904687#M357411</guid>
      <dc:creator>makset</dc:creator>
      <dc:date>2023-11-27T18:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: conver datetime to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904689#M357413</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17744"&gt;@makset&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;I have it"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let DTCut = "2022-08-18-23-59-59";&lt;BR /&gt;or&amp;nbsp;&lt;BR /&gt;%let DTCut = "2022-08-18-23-59-59"dt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I want this:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;DTCut = 1976486399&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;sorry for the confusion&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;My earlier code produces this exact result.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2023 18:57:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904689#M357413</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-27T18:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: conver datetime to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904692#M357415</link>
      <description>&lt;P&gt;from this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let m8=Aug;
%let dtcut = %sysevalf("18&amp;amp;m8.2022:23:59:59"dt);
%put &amp;amp;=dtcut;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;not this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dtcut = %sysevalf("2022-08-18-23-59-59"dt);
%put &amp;amp;=dtcut;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;ERROR: Unknown %SYSEVALF conversion operand 'DTCUSTOM.' specified; conversion is terminated.&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric&lt;BR /&gt;operand is required. The condition was: putn("2022-08-18-23-59-59"&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2023 19:03:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904692#M357415</guid>
      <dc:creator>makset</dc:creator>
      <dc:date>2023-11-27T19:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: conver datetime to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904693#M357416</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17744"&gt;@makset&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;from this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let m8=Aug;
%let dtcut = %sysevalf("18&amp;amp;m8.2022:23:59:59"dt);
%put &amp;amp;=dtcut;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, the code I provided works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;not this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dtcut = %sysevalf("2022-08-18-23-59-59"dt);
%put &amp;amp;=dtcut;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;ERROR: Unknown %SYSEVALF conversion operand 'DTCUSTOM.' specified; conversion is terminated.&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric&lt;BR /&gt;operand is required. The condition was: putn("2022-08-18-23-59-59"&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No one ever said this would work. It doesn't work because &lt;CODE class=" language-sas"&gt;"2022-08-18-23-59-59"dt &lt;/CODE&gt;is not recognized anywhere in SAS as valid code.&amp;nbsp; Only date/time literals like this will work: "18aug2022:23:59:59"dt, the appearance must be that exactly, except the the letters can be mixed case or upper case. Your date time value is not that appearance, so SAS will not recognize it and can't use it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, this works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dtcut = %sysfunc(inputn(2022-08-18-23-59-59,anydtdtm.));
%put &amp;amp;=dtcut;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2023 19:13:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904693#M357416</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-27T19:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: conver datetime to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904695#M357418</link>
      <description>&lt;P&gt;And that's it&lt;BR /&gt;Thank you&lt;BR /&gt;Respect&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2023 19:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/conver-datetime-to-numeric/m-p/904695#M357418</guid>
      <dc:creator>makset</dc:creator>
      <dc:date>2023-11-27T19:15:21Z</dc:date>
    </item>
  </channel>
</rss>

