<?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: Insert DATETIME Column in SQL Server in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763409#M241773</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally ended up doing this. Im still not sure how this works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/*setting timestamp format for LoadDate */
proc format;
	picture myfmt low-high = '%Y-%0m-%0d %0H:%0M' (datatype = datetime);
run;


proc sql;
 	insert into IVR_CXBT.PrgmEnrollments  

		select 	CONTRACT_ACCT as ContractAcct,
				PROGRAM_PROGRAM as ProgramName,
				PROGRAM_START_DT as StartDate,
				PROGRAM_END_DT as EndDate,
				PROGRAM_STATUS as Status,
				PROGRAM_STATUS_DT as StatusDate,
			    input(put(datetime(),myfmt.),anydtdtm.) as LoadDate format=myfmt.
		from	PROGRAM_SUMMARY(obs=2)
	;
run;


&lt;/PRE&gt;</description>
    <pubDate>Tue, 24 Aug 2021 03:54:33 GMT</pubDate>
    <dc:creator>rajesh1980</dc:creator>
    <dc:date>2021-08-24T03:54:33Z</dc:date>
    <item>
      <title>Insert DATETIME Column in SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763320#M241731</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to insert rows into a SQL Server table from SAS. One of the columns in the table is defined as SMALL DATETIME. Here is the DDL&lt;/P&gt;&lt;P&gt;Create table cccbot.PrgmEnrollments (&lt;BR /&gt;ContractAcct VARCHAR(16) null,&lt;BR /&gt;ProgramName VARCHAR(35) null,&lt;BR /&gt;StartDate date null,&lt;BR /&gt;EndDate date null,&lt;BR /&gt;Status VARCHAR(30) null,&lt;BR /&gt;StatusDate date null,&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;LoadDate smalldatetime null)&lt;/FONT&gt;&lt;BR /&gt;on [PRIMARY] ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my SAS code i try this and it is not working&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;proc sql;
 	insert into IVR_CXBT.PrgmEnrollments  

		select 	CONTRACT_ACCT as ContractAcct,
				PROGRAM_PROGRAM as ProgramName,
				PROGRAM_START_DT as StartDate,
				PROGRAM_END_DT as EndDate,
				PROGRAM_STATUS as Status,
				PROGRAM_STATUS_DT as StatusDate,
			    datetime() as LoadDate format datetime20.
		from	PROGRAM_SUMMARY(obs=2)
	;

run;&lt;/LI-CODE&gt;&lt;P&gt;However i get a date time overflow error.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: CLI execute error: [SAS][ODBC SQL Server Wire Protocol driver]Datetime field overflow. Error in parameter 7.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: ROLLBACK issued due to errors for data set IVR_CXBT.PrgmEnrollments.DATA.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried a variation of the insert statement with PUT and INPUT statements still no luck.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;proc sql;
 	insert into IVR_CXBT.PrgmEnrollments  

		select 	CONTRACT_ACCT as ContractAcct,
				PROGRAM_PROGRAM as ProgramName,
				PROGRAM_START_DT as StartDate,
				PROGRAM_END_DT as EndDate,
				PROGRAM_STATUS as Status,
				PROGRAM_STATUS_DT as StatusDate,
			    input(put(datetime(),datetime20.),datetime20.) as LoadDate
		from	PROGRAM_SUMMARY(obs=2)
	;

run;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Please help me..&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 18:51:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763320#M241731</guid>
      <dc:creator>rajesh1980</dc:creator>
      <dc:date>2021-08-23T18:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Insert DATETIME Column in SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763323#M241734</link>
      <description>&lt;P&gt;Do you know if by "parameter 7" it means the 7th field?&lt;/P&gt;
&lt;P&gt;Try attaching a format to the value so SAS knows you intended as number of seconds instead a generic floating point value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  insert into IVR_CXBT.PrgmEnrollments  
    select
      CONTRACT_ACCT as ContractAcct
    , PROGRAM_PROGRAM as ProgramName
    , PROGRAM_START_DT as StartDate
    , PROGRAM_END_DT as EndDate
    , PROGRAM_STATUS as Status
    , PROGRAM_STATUS_DT as StatusDate
    , datetime() as LoadDate format=datetime19.
    from PROGRAM_SUMMARY(obs=2)
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;All that your current put()/input() sandwich is doing is dropping the fractions of a second.&amp;nbsp; If that is important just use the INT(), FLOOR() or ROUND() function to convert the datatime value into an integer number of seconds.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    , int(datetime()) as LoadDate format=datetime19.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Aug 2021 18:58:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763323#M241734</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-23T18:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Insert DATETIME Column in SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763325#M241735</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im getting the same error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;24 proc sql;&lt;BR /&gt;25 insert into IVR_CXBT.PrgmEnrollments&lt;BR /&gt;26&lt;BR /&gt;27 select CONTRACT_ACCT as ContractAcct,&lt;BR /&gt;28 PROGRAM_PROGRAM as ProgramName,&lt;BR /&gt;29 PROGRAM_START_DT as StartDate,&lt;BR /&gt;30 PROGRAM_END_DT as EndDate,&lt;BR /&gt;31 PROGRAM_STATUS as Status,&lt;BR /&gt;32 PROGRAM_STATUS_DT as StatusDate,&lt;BR /&gt;33 datetime() as LoadDate format=datetime19.&lt;BR /&gt;34 from PROGRAM_SUMMARY(obs=2)&lt;BR /&gt;35 ;&lt;BR /&gt;WARNING: Character expression will be truncated when assigned to character column ContractAcct.&lt;BR /&gt;WARNING: Character expression will be truncated when assigned to character column Status.&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: CLI execute error: [SAS][ODBC SQL Server Wire Protocol driver]Datetime field overflow. Error in parameter 7.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: ROLLBACK issued due to errors for data set IVR_CXBT.PrgmEnrollments.DATA.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 19:00:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763325#M241735</guid>
      <dc:creator>rajesh1980</dc:creator>
      <dc:date>2021-08-23T19:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Insert DATETIME Column in SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763334#M241741</link>
      <description>&lt;P&gt;In that case the error is probably in how the field is define in the database.&amp;nbsp; Not that I have personal experience, but from other questions I have seen when dealing with how databases define date, time and datetime values they can use other settings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example it might be as simple as the database thinking the field is actual a real DATE field and not the DATETIME field you are telling SAS that it is.&amp;nbsp; In that case you could try using the DATE() function, also known as TODAY(), and the DATE9. format instead.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 19:38:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763334#M241741</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-23T19:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Insert DATETIME Column in SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763337#M241743</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried and it is still not working I ended up adding a extra column in the input SAS dataset and then referenced it in the INSERT sattement. Not sure why, but it is working, even though im not happy with the solution to the fullest &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/* Merge all PROGRAM_ datasets to one summary dataset*/
data PROGRAM_SUMMARY;
	set PROGRAM_:;
	if PROGRAM_STATUS_DT = '01JAN1900'd then PROGRAM_STATUS_DT = . ;
	PROGRAM_LOAD_DT = put(datetime(),datetime20.);
run;

proc sql;
 	insert into IVR_CXBT.PrgmEnrollments  

		select 	CONTRACT_ACCT as ContractAcct,
				PROGRAM_PROGRAM as ProgramName,
				PROGRAM_START_DT as StartDate,
				PROGRAM_END_DT as EndDate,
				PROGRAM_STATUS as Status,
				PROGRAM_STATUS_DT as StatusDate,
			    input(PROGRAM_LOAD_DT,datetime20.) as LoadDate format datetime20.
		from	PROGRAM_SUMMARY(obs=2)
	;

run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Aug 2021 19:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763337#M241743</guid>
      <dc:creator>rajesh1980</dc:creator>
      <dc:date>2021-08-23T19:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Insert DATETIME Column in SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763341#M241747</link>
      <description>&lt;P&gt;If that works then the issue probably was the fractional seconds.&lt;/P&gt;
&lt;P&gt;Try the version with the INT() function call again.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;,int(datetime()) as LoadDate format=datetime19.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note you don't need include two extra spaces in the DATETIME format, one is enough to get it to print the full four digits of the year and avoid whatever bug causes to use two digits even though there is room for four in 18 characters.&lt;/P&gt;
&lt;PRE&gt;310   data _null_;
311   now=datetime();
312   put now datetime18.
313     / now datetime19.
314     / now datetime20.
315   ;
316   run;

  23AUG21:15:52:01
 23AUG2021:15:52:01
  23AUG2021:15:52:01
&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Aug 2021 19:56:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763341#M241747</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-23T19:56:28Z</dc:date>
    </item>
    <item>
      <title>Re: Insert DATETIME Column in SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763365#M241753</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No luck. However i noticed that in the SQL Server the datetime is stored as YYYY-MM-DD HH:MM (note that there is space between date and time and not : and there is no seconds as well).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Taking this info i did something like this which is working, better than my first solution. but still i would like to have the datetime called inside the proc sql.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc format;
	picture myfmt low-high = '%Y-%0m-%0d %0H:%0M' (datatype = datetime);
run;
%let tstamp = %sysfunc(datetime(), myfmt.);

proc sql;
 	insert into IVR_CXBT.PrgmEnrollments  

		select 	CONTRACT_ACCT as ContractAcct,
				PROGRAM_PROGRAM as ProgramName,
				PROGRAM_START_DT as StartDate,
				PROGRAM_END_DT as EndDate,
				PROGRAM_STATUS as Status,
				PROGRAM_STATUS_DT as StatusDate,
			    "&amp;amp;tstamp."dt as LoadDate
		from	PROGRAM_SUMMARY(obs=2)
	;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Aug 2021 21:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763365#M241753</guid>
      <dc:creator>rajesh1980</dc:creator>
      <dc:date>2021-08-23T21:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Insert DATETIME Column in SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763382#M241756</link>
      <description>&lt;P&gt;Something is weird.&amp;nbsp;Seconds should be accepted according to&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/sql/t-sql/data-types/smalldatetime-transact-sql?view=sql-server-ver15" target="_blank"&gt;https://docs.microsoft.com/en-us/sql/t-sql/data-types/smalldatetime-transact-sql?view=sql-server-ver15&lt;/A&gt;&amp;nbsp;but there's something's we're told: 4 bytes can store 4.3 billion values, but the interval given contains 65k days or 5.3 billion seconds. Microsoft shenanigans at play here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;nbsp; case when&amp;nbsp;PROGRAM_LOAD_DT &amp;lt; '01jan1950:00:00'dt then . else int(PROGRAM_LOAD_DT) end as&amp;nbsp;PROGRAM_LOAD_DT format=datetime20.0&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or maybe no seconds:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;nbsp; case when&amp;nbsp;PROGRAM_LOAD_DT &amp;lt; '01jan1950:00:00'dt then . else round(PROGRAM_LOAD_DT,60) end as&amp;nbsp;PROGRAM_LOAD_DT format=datetime20.0&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, 23 Aug 2021 22:37:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763382#M241756</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-08-23T22:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Insert DATETIME Column in SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763392#M241761</link>
      <description>&lt;P&gt;Actually I see in the examples on the Microsoft page (and in the introduction at the top) that they scrub off seconds, so the numbers make more sense, though by having no seconds means we have 2^32 minutes or 8,000 years, so the limited 179-year interval seems unwarranted. Y2k all over again in 2079....&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 00:22:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763392#M241761</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-08-24T00:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: Insert DATETIME Column in SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763409#M241773</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally ended up doing this. Im still not sure how this works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/*setting timestamp format for LoadDate */
proc format;
	picture myfmt low-high = '%Y-%0m-%0d %0H:%0M' (datatype = datetime);
run;


proc sql;
 	insert into IVR_CXBT.PrgmEnrollments  

		select 	CONTRACT_ACCT as ContractAcct,
				PROGRAM_PROGRAM as ProgramName,
				PROGRAM_START_DT as StartDate,
				PROGRAM_END_DT as EndDate,
				PROGRAM_STATUS as Status,
				PROGRAM_STATUS_DT as StatusDate,
			    input(put(datetime(),myfmt.),anydtdtm.) as LoadDate format=myfmt.
		from	PROGRAM_SUMMARY(obs=2)
	;
run;


&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Aug 2021 03:54:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763409#M241773</guid>
      <dc:creator>rajesh1980</dc:creator>
      <dc:date>2021-08-24T03:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Insert DATETIME Column in SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763411#M241774</link>
      <description>&lt;P&gt;You are just rounding by 60 I think.&lt;/P&gt;
&lt;P&gt;What happened to using variable&amp;nbsp;PROGRAM_LOAD_DT ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 04:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763411#M241774</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-08-24T04:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Insert DATETIME Column in SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763481#M241809</link>
      <description>&lt;P&gt;Not sure why you keep converting your dates into string and then back into numbers by using PUT() and INPUT().&lt;/P&gt;
&lt;P&gt;If you want to round to the nearest minute use the ROUND() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;round(datetime(),60)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or truncate to the minute&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;int(datetime()/60)*60&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or use intnx()&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;intnx('minute',datetime(),0,'b')&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also the format you attach should not matter as long as it is a format designed to operate on datetime values so that SAS knows what type of conversion it should be doing when preparing to transfer the data.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 12:03:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/763481#M241809</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-24T12:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Insert DATETIME Column in SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/764110#M241996</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Apologies for the late reply, was carried away with work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tthe PROGRAM_LOAD_DT solution was working earlier as i had mentioned, but i was not happy with it, as it involved creating an extra column in my input dataset, i wanted it more Realtime during the PROC SQL.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 05:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/764110#M241996</guid>
      <dc:creator>rajesh1980</dc:creator>
      <dc:date>2021-08-26T05:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Insert DATETIME Column in SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/764112#M241997</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ROUND worked like charm..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
 	insert into IVR_CXBT.PrgmEnrollments  

		select 	CONTRACT_ACCT as ContractAcct,
				PROGRAM_PROGRAM as ProgramName,
				PROGRAM_START_DT as StartDate,
				PROGRAM_END_DT as EndDate,
				PROGRAM_STATUS as Status,
				PROGRAM_STATUS_DT as StatusDate,
			    round(datetime(),60) as LoadDate
		from	PROGRAM_SUMMARY(obs=2)
	;
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Aug 2021 05:43:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-DATETIME-Column-in-SQL-Server/m-p/764112#M241997</guid>
      <dc:creator>rajesh1980</dc:creator>
      <dc:date>2021-08-26T05:43:34Z</dc:date>
    </item>
  </channel>
</rss>

