<?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: Function DHMS requires a numeric expression in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Function-DHMS-requires-a-numeric-expression/m-p/882403#M39120</link>
    <description>&lt;P&gt;Maxim 3: Know Your Data.&lt;/P&gt;
&lt;P&gt;Inspect your dataset (e.g. with PROC CONTENTS) to see the attributes of ccreatedtime; if there is no other variable in the dataset which stores this value as a true SAS time, you need to convert from character to a numeric value with the INPUT function. Use an informat which fits the notation of the time.&lt;/P&gt;</description>
    <pubDate>Mon, 26 Jun 2023 10:33:27 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2023-06-26T10:33:27Z</dc:date>
    <item>
      <title>Function DHMS requires a numeric expression</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Function-DHMS-requires-a-numeric-expression/m-p/882393#M39117</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I am using DHMS function to get the date time values but I am getting some error. Can you please let me know what is wrong in the code? This is the first code that I am using in the program so I don't have a sample dataset. I am pulling the information from debtsupport table. Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table ctrigger_id as 
	select distinct
			debt_code,
			ctrigger,
			dcreateddate,
			ccreatedtime,
			dhms(datepart(dcreateddate),0,0,ccreatedtime) as Trigger_Date format datetime22.3,
			ccreateduser,
			datepart(dcreateddate) as dcreateddate_DT format date9.
		from p2scflow.debtsupport
			where ctrigger like '%15%'
				order by dcreateddate;
quit;
Error log:
30         proc sql;
31         create table ctrigger_id as
32         	select distinct
33         			debt_code,
34         			ctrigger,
35         			dcreateddate,
36         			ccreatedtime,
37         			dhms(datepart(dcreateddate),0,0,ccreatedtime) as Trigger_Date format datetime22.3,
38         			ccreateduser,
39         			datepart(dcreateddate) as dcreateddate_DT format date9.
40         		from p2scflow.debtsupport
41         			where ctrigger like '%15%'
42         				order by dcreateddate;
ERROR: Function DHMS requires a numeric expression as argument 4.
ERROR: Character expression requires a character format.
ERROR: Character expression requires a character format.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
43         quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.09 seconds
      user cpu time       0.00 seconds
      system cpu time     0.03 seconds
      memory              5786.03k
      OS Memory           29532.00k
      Timestamp           06/26/2023 09:17:45 AM
      Step Count                        3  Switch Count  13&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Jun 2023 08:44:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Function-DHMS-requires-a-numeric-expression/m-p/882393#M39117</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2023-06-26T08:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: Function DHMS requires a numeric expression</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Function-DHMS-requires-a-numeric-expression/m-p/882395#M39118</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/391779"&gt;@Sandeep77&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you try executing the below, what does it show for&amp;nbsp;ccreatedtime?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, is there maybe a variable (column) named createdtime, without the extra 'c' at the beginning which might indicate a character version of a numeric variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data = p2scflow.debtsupport;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 09:02:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Function-DHMS-requires-a-numeric-expression/m-p/882395#M39118</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2023-06-26T09:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Function DHMS requires a numeric expression</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Function-DHMS-requires-a-numeric-expression/m-p/882396#M39119</link>
      <description>Please read the documentation on dhms. The 4th argument needs to be numeric. For examples you can also read: &lt;A href="https://support.sas.com/resources/papers/proceedings20/4801-2020.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings20/4801-2020.pdf&lt;/A&gt;</description>
      <pubDate>Mon, 26 Jun 2023 09:07:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Function-DHMS-requires-a-numeric-expression/m-p/882396#M39119</guid>
      <dc:creator>JosvanderVelden</dc:creator>
      <dc:date>2023-06-26T09:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Function DHMS requires a numeric expression</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Function-DHMS-requires-a-numeric-expression/m-p/882403#M39120</link>
      <description>&lt;P&gt;Maxim 3: Know Your Data.&lt;/P&gt;
&lt;P&gt;Inspect your dataset (e.g. with PROC CONTENTS) to see the attributes of ccreatedtime; if there is no other variable in the dataset which stores this value as a true SAS time, you need to convert from character to a numeric value with the INPUT function. Use an informat which fits the notation of the time.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 10:33:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Function-DHMS-requires-a-numeric-expression/m-p/882403#M39120</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-26T10:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Function DHMS requires a numeric expression</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Function-DHMS-requires-a-numeric-expression/m-p/882404#M39121</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/22588"&gt;@Amir&lt;/a&gt;&amp;nbsp; ccreated time shows the time and dcreateddate shows the date as below:&lt;/P&gt;
&lt;TABLE width="248"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="163"&gt;dcreateddate&lt;/TD&gt;
&lt;TD width="85"&gt;ccreatedtime&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;02MAY2019:00:00:00.000&lt;/TD&gt;
&lt;TD&gt;10:14:31&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;dcreateddate is numeric and format is Datetime22.3&lt;/P&gt;
&lt;P&gt;ccreatedtime is Character value.&lt;/P&gt;
&lt;P&gt;What can I do to correct the error?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 10:43:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Function-DHMS-requires-a-numeric-expression/m-p/882404#M39121</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2023-06-26T10:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: Function DHMS requires a numeric expression</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Function-DHMS-requires-a-numeric-expression/m-p/882410#M39123</link>
      <description>&lt;P&gt;Convert the time value with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input(ccreatedtime,time8.)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to the numeric value required by the DHMS function.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 11:06:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Function-DHMS-requires-a-numeric-expression/m-p/882410#M39123</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-26T11:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: Function DHMS requires a numeric expression</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Function-DHMS-requires-a-numeric-expression/m-p/882417#M39124</link>
      <description>&lt;P&gt;So the first variable is already in seconds (number of seconds since 1960) so use the INPUT() function to convert the second variable to the number of seconds since midnight and add them together.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dcreateddate + input(ccreatedtime,time8.)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Jun 2023 12:03:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Function-DHMS-requires-a-numeric-expression/m-p/882417#M39124</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-26T12:03:31Z</dc:date>
    </item>
  </channel>
</rss>

