<?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: Need a substitute for &amp;quot;add_months()&amp;quot; teradata function in sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892545#M352514</link>
    <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;I just checked again the the dates are in datetime19. format&lt;/P&gt;</description>
    <pubDate>Mon, 04 Sep 2023 12:39:49 GMT</pubDate>
    <dc:creator>Coco_08</dc:creator>
    <dc:date>2023-09-04T12:39:49Z</dc:date>
    <item>
      <title>Need a substitute for "add_months()" teradata function in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892512#M352498</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Could anyone please help me with a substitute for below statement in sas.&lt;/P&gt;&lt;P&gt;%rd=5;&lt;/P&gt;&lt;P&gt;lts &amp;lt; add_months(CURRENT_TIMESTAMP, -12 * &amp;amp;rd.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thankyou&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 07:24:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892512#M352498</guid>
      <dc:creator>Coco_08</dc:creator>
      <dc:date>2023-09-04T07:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Need a substitute for "add_months()" teradata function in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892514#M352499</link>
      <description>&lt;P&gt;I think the equivalent in SAS would be INTNX function using the 'MONTH' option:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p10v3sa3i4kfxfn1sovhi5xzxh8n.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p10v3sa3i4kfxfn1sovhi5xzxh8n.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 07:44:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892514#M352499</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-09-04T07:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: Need a substitute for "add_months()" teradata function in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892518#M352500</link>
      <description>&lt;P&gt;Hi thankyou for your reply.I tried intnx but i am getting below error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where lts &amp;lt; intnx('month',CURRENT_TIMESTAMP, -12&lt;BR /&gt;SYMBOLGEN: Macro variable RTD resolves to 5&lt;BR /&gt;39 ! * &amp;amp;rtd.) )b;&lt;BR /&gt;ERROR: Function INTNX requires a numeric expression as argument 2.&lt;BR /&gt;ERROR: Expression using less than (&amp;lt;) has components that are of different data types.&lt;BR /&gt;ERROR: Function INTNX requires a numeric expression as argument 2.&lt;BR /&gt;ERROR: Expression using less than (&amp;lt;) has components that are of different data types.&lt;BR /&gt;ERROR: The following columns were not found in the contributing tables: CURRENT_TIMESTAMP.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what am i doing wrong&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 09:01:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892518#M352500</guid>
      <dc:creator>Coco_08</dc:creator>
      <dc:date>2023-09-04T09:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need a substitute for "add_months()" teradata function in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892527#M352501</link>
      <description>&lt;P&gt;CURRENT_TIMESTAMP is also Teradata syntax. Use the SAS Date or Datetime function instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
  SAS_datetime_value=intnx('dtmonth',datetime(),-12,'s');
  SAS_date_value=intnx('month',date(),-12,'s');
run;

proc print data=demo;
  format SAS_datetime_value datetime20. SAS_date_value date9.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1693821617165.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87597iC1E39DBA098779E6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1693821617165.png" alt="Patrick_0-1693821617165.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 10:00:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892527#M352501</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-09-04T10:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Need a substitute for "add_months()" teradata function in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892530#M352502</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;thankyou for your reply,datetime works but i am getting 0 records,is it the multiplication issue here?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;where lts &amp;lt; intnx('month',datetime(), -12 * &amp;amp;rtncd.,"S")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where lts &amp;lt; intnx('month',datetime(), -12&lt;BR /&gt;SYMBOLGEN: Macro variable RTNCD resolves to 5&lt;BR /&gt;41 ! * &amp;amp;rtncd.,"S") )b;&lt;BR /&gt;NOTE: Invalid argument to function INTNX. Missing values may be generated.&lt;BR /&gt;NOTE: Invalid argument to function INTNX. Missing values may be generated.&lt;BR /&gt;NOTE: The execution of this query involves performing one or more Cartesian product joins that can not be optimized.&lt;BR /&gt;NOTE: SAS variable labels, formats, and lengths are not written to DBMS tables.&lt;BR /&gt;NOTE: Teradata connection: TPT FastExport has read 1066000 row(s).&lt;BR /&gt;NOTE: Table WORKDB.CNT_DLT_VLMS created, with 0 rows and 3 columns.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 10:57:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892530#M352502</guid>
      <dc:creator>Coco_08</dc:creator>
      <dc:date>2023-09-04T10:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Need a substitute for "add_months()" teradata function in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892533#M352505</link>
      <description>&lt;P&gt;Can you show the full log?&lt;/P&gt;
&lt;P&gt;Also, since Teradata is involved, add this to your code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options msglevel=i sastrace=',,,d' sastraceloc=saslog nostsuffix; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Sep 2023 11:22:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892533#M352505</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-09-04T11:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need a substitute for "add_months()" teradata function in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892534#M352506</link>
      <description>Also, just to understand your query.&lt;BR /&gt;The current code will pick records that is 5 years or older.&lt;BR /&gt;And does "lts" have timestamp values or dates?</description>
      <pubDate>Mon, 04 Sep 2023 11:25:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892534#M352506</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-09-04T11:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Need a substitute for "add_months()" teradata function in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892539#M352510</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp; yes the current code will pick the values before 5years.the dates present are in timestamp&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 12:04:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892539#M352510</guid>
      <dc:creator>Coco_08</dc:creator>
      <dc:date>2023-09-04T12:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: Need a substitute for "add_months()" teradata function in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892541#M352512</link>
      <description>&lt;P&gt;here is the log-&lt;/P&gt;&lt;P&gt;1 The SAS System 04:02 Monday, September 4, 2023&lt;/P&gt;&lt;P&gt;1 ;*';*";*/;quit;run;&lt;BR /&gt;2 OPTIONS PAGENO=MIN;&lt;BR /&gt;3 %LET _CLIENTTASKLABEL='Program';&lt;BR /&gt;4 %LET _CLIENTPROCESSFLOWNAME='Process Flow';&lt;BR /&gt;5 %LET _CLIENTPROJECTPATH='';&lt;BR /&gt;6 %LET _CLIENTPROJECTPATHHOST='';&lt;BR /&gt;7 %LET _CLIENTPROJECTNAME='';&lt;BR /&gt;8 %LET _SASPROGRAMFILE='';&lt;BR /&gt;9 %LET _SASPROGRAMFILEHOST='';&lt;BR /&gt;10&lt;BR /&gt;11 ODS _ALL_ CLOSE;&lt;BR /&gt;12 OPTIONS DEV=ACTIVEX;&lt;BR /&gt;13 GOPTIONS XPIXELS=0 YPIXELS=0;&lt;BR /&gt;14 FILENAME EGSR TEMP;&lt;BR /&gt;15 ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR&lt;BR /&gt;16 STYLE=HtmlBlue&lt;BR /&gt;17 STYLESHEET=(URL="file:///C:/Program%20Files/SASHome2/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css")&lt;BR /&gt;18 NOGTITLE&lt;BR /&gt;19 NOGFOOTNOTE&lt;BR /&gt;20 GPATH=&amp;amp;sasworklocation&lt;BR /&gt;SYMBOLGEN: Macro variable SASWORKLOCATION resolves to "/tmp/SAS_work2ADC000020D2_cdpra00a0312/SAS_work8744000020D2_cdpra00a0312/"&lt;BR /&gt;21 ENCODING=UTF8&lt;BR /&gt;22 options(rolap="on")&lt;BR /&gt;23 ;&lt;BR /&gt;NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR&lt;BR /&gt;24&lt;BR /&gt;25 GOPTIONS ACCESSIBLE;&lt;BR /&gt;26 options msglevel=i sastrace=',,,d' sastraceloc=saslog nostsuffix;&lt;BR /&gt;27 proc sql;&lt;BR /&gt;28 drop table WORKDB.CNT_DLT_VLMS;&lt;BR /&gt;&lt;BR /&gt;TERADATA_0: Prepared: on connection 11&lt;BR /&gt;SELECT * FROM D_FCDS_EAA."CNT_DLT_VLMS"&lt;BR /&gt;&lt;BR /&gt;TERADATA: trforc: COMMIT WORK&lt;BR /&gt;&lt;BR /&gt;TERADATA_1: Executed: on connection 11&lt;BR /&gt;DROP TABLE D_FCDS_EAA."CNT_DLT_VLMS"&lt;BR /&gt;&lt;BR /&gt;TERADATA: trforc: COMMIT WORK&lt;BR /&gt;NOTE: Table WORKDB.CNT_DLT_VLMS has been dropped.&lt;BR /&gt;29 quit;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.10 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;/P&gt;&lt;P&gt;30&lt;BR /&gt;31 proc sql;&lt;BR /&gt;32 create table WORKDB.CNT_DLT_VLMS as&lt;BR /&gt;33 select a.distinct_load_ts ,&lt;BR /&gt;34 a.volume_records,&lt;BR /&gt;35 b.to_delete_records&lt;BR /&gt;36 from (select load_ts as distinct_load_ts&lt;BR /&gt;37 ,count(load_ts) as volume_records&lt;BR /&gt;38 from FCORE_EE.peergrp&lt;BR /&gt;39 where load_ts &amp;lt; intnx('month',datetime(), -12&lt;BR /&gt;SYMBOLGEN: Macro variable RTNCD resolves to 5&lt;BR /&gt;39 ! * &amp;amp;rtncd.,"S")&lt;BR /&gt;40 group by 1 ) a&lt;BR /&gt;41 ,(select count(*) as to_delete_records&lt;BR /&gt;42 from FCORE_EE.peergrp&lt;BR /&gt;43 where load_ts &amp;lt; intnx('month',datetime(), -12&lt;BR /&gt;SYMBOLGEN: Macro variable RTNCD resolves to 5&lt;BR /&gt;43 ! * &amp;amp;rtncd.,"S") )b;&lt;BR /&gt;&lt;BR /&gt;TERADATA_2: Prepared: on connection 15&lt;BR /&gt;SELECT * FROM libc."peergrp"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;TERADATA_3: Prepared: on connection 16&lt;BR /&gt;SELECT * FROM libc."peergrp"&lt;BR /&gt;&lt;BR /&gt;NOTE: Invalid argument to function INTNX. Missing values may be generated.&lt;BR /&gt;NOTE: Invalid argument to function INTNX. Missing values may be generated.&lt;BR /&gt;&lt;BR /&gt;TERADATA_4: Prepared: on connection 17&lt;BR /&gt;select a."distinct_load_ts", a."volume_records", b."to_delete_records" from ( select TXT_1."LOAD_TS" as "distinct_load_ts", COUNT(TXT_1."LOAD_TS") as "volume_records" from "D_FCDS_S_FCCORE_E0"."peergrp" TXT_1 where TXT_1."LOAD_TS" &amp;lt; NULL&lt;BR /&gt;group by TXT_1."LOAD_TS" ) a, ( select COUNT(*) as "to_delete_records" from "libc"."peergrp" TXT_2 where TXT_2."LOAD_TS" &amp;lt; NULL ) b&lt;BR /&gt;&lt;BR /&gt;TERADATA: trforc: COMMIT WORK&lt;BR /&gt;ACCESS ENGINE: ERROR: Teradata prepare: The user must use IS NULL or IS NOT NULL to test for NULL values. SQL statement was: select a."distinct_load_ts", a."volume_records", b."to_delete_records" from ( select TXT_1."LOAD_TS" as "distinct_load_ts",&lt;BR /&gt;COUNT(TXT_1."LOAD_TS") as "volume_records" from "libc"."peergrp" TXT_1 where TXT_1."LOAD_TS" &amp;lt; NULL group by TXT_1."LOAD_TS" ) a, ( select COUNT(*) as "to_delete_records" from "libc"."peergrp"&lt;BR /&gt;TXT_2 where TXT_2."LOAD_TS" &amp;lt; NULL ) b.&lt;BR /&gt;ACCESS ENGINE: SQL statement was not passed to the DBMS, SAS will do the processing.&lt;BR /&gt;&lt;BR /&gt;TERADATA_5: Prepared: on connection 17&lt;BR /&gt;select TXT_1."LOAD_TS" as "distinct_load_ts", COUNT(TXT_1."LOAD_TS") as "volume_records" from "libc"."peergrp" TXT_1 where TXT_1."LOAD_TS" &amp;lt; NULL group by TXT_1."LOAD_TS"&lt;BR /&gt;&lt;BR /&gt;TERADATA: trforc: COMMIT WORK&lt;BR /&gt;ACCESS ENGINE: ERROR: Teradata prepare: The user must use IS NULL or IS NOT NULL to test for NULL values. SQL statement was: select TXT_1."LOAD_TS" as "distinct_load_ts", COUNT(TXT_1."LOAD_TS") as "volume_records" from&lt;BR /&gt;"libc"."peergrp" TXT_1 where TXT_1."LOAD_TS" &amp;lt; NULL group by TXT_1."LOAD_TS".&lt;BR /&gt;ACCESS ENGINE: SQL statement was not passed to the DBMS, SAS will do the processing.&lt;BR /&gt;&lt;BR /&gt;TERADATA_6: Prepared: on connection 17&lt;BR /&gt;select COUNT(*) as "to_delete_records" from "libc"."peergrp" TXT_2 where TXT_2."LOAD_TS" &amp;lt; NULL&lt;BR /&gt;&lt;BR /&gt;TERADATA: trforc: COMMIT WORK&lt;BR /&gt;ACCESS ENGINE: ERROR: Teradata prepare: The user must use IS NULL or IS NOT NULL to test for NULL values. SQL statement was: select COUNT(*) as "to_delete_records" from "libc"."peergrp" TXT_2 where TXT_2."LOAD_TS" &amp;lt; NULL .&lt;BR /&gt;ACCESS ENGINE: SQL statement was not passed to the DBMS, SAS will do the processing.&lt;BR /&gt;NOTE: The execution of this query involves performing one or more Cartesian product joins that can not be optimized.&lt;BR /&gt;&lt;BR /&gt;TERADATA_7: Prepared: on connection 11&lt;BR /&gt;SELECT * FROM D_FCDS_EAA."CNT_DLT_VLMS"&lt;BR /&gt;&lt;BR /&gt;TERADATA: trforc: COMMIT WORK&lt;BR /&gt;NOTE: SAS variable labels, formats, and lengths are not written to DBMS tables.&lt;BR /&gt;&lt;BR /&gt;TERADATA_8: Executed: on connection 17&lt;BR /&gt;CREATE MULTISET TABLE D_FCDS_EAA."CNT_DLT_VLMS" ("distinct_load_ts" TIMESTAMP(0),"volume_records" FLOAT,"to_delete_records" FLOAT);COMMIT WORK&lt;BR /&gt;&lt;BR /&gt;NOTE: SAS threaded sort was used.&lt;BR /&gt;TERADATA: trqacol- No casting. Raw row size=19, Casted size=19, CAST_OVERHEAD_MAXPERCENT=20%&lt;BR /&gt;&lt;BR /&gt;TERADATA_9: Prepared: on connection 15&lt;BR /&gt;SELECT "LOAD_TS" FROM libc."peergrp"&lt;BR /&gt;&lt;BR /&gt;TERADATA: trforc: COMMIT WORK&lt;BR /&gt;TERADATA: trforc: COMMIT WORK&lt;BR /&gt;NOTE: Teradata connection: TPT FastExport has read 1066000 row(s).&lt;BR /&gt;TERADATA: trforc: COMMIT WORK&lt;BR /&gt;NOTE: Table WORKDB.CNT_DLT_VLMS created, with 0 rows and 3 columns.&lt;/P&gt;&lt;P&gt;44 quit;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 2.79 seconds&lt;BR /&gt;cpu time 0.35 seconds&lt;/P&gt;&lt;P&gt;45&lt;BR /&gt;46 GOPTIONS NOACCESSIBLE;&lt;BR /&gt;47 %LET _CLIENTTASKLABEL=;&lt;BR /&gt;48 %LET _CLIENTPROCESSFLOWNAME=;&lt;BR /&gt;49 %LET _CLIENTPROJECTPATH=;&lt;BR /&gt;50 %LET _CLIENTPROJECTPATHHOST=;&lt;BR /&gt;51 %LET _CLIENTPROJECTNAME=;&lt;BR /&gt;52 %LET _SASPROGRAMFILE=;&lt;BR /&gt;53 %LET _SASPROGRAMFILEHOST=;&lt;BR /&gt;54&lt;BR /&gt;55 ;*';*";*/;quit;run;&lt;BR /&gt;56 ODS _ALL_ CLOSE;&lt;BR /&gt;57&lt;BR /&gt;58&lt;BR /&gt;59 QUIT; RUN;&lt;BR /&gt;60&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 12:05:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892541#M352512</guid>
      <dc:creator>Coco_08</dc:creator>
      <dc:date>2023-09-04T12:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Need a substitute for "add_months()" teradata function in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892542#M352513</link>
      <description>&lt;P&gt;If your source columns are in timestamp (detetime in SAS, you need to prefix your interval with DT:&lt;BR /&gt;"&lt;EM&gt;Interval names that are used with SAS date values can be prefixed with 'DT' to construct interval names for use with SAS datetime values. The interval names DTYEAR, DTSEMIYEAR, DTQTR, &lt;STRONG&gt;DTMONTH&lt;/STRONG&gt;, DTSEMIMONTH, DTTENDAY, DTWEEK, DTWEEKDAY, and DTDAY are used with SAS time or datetime values.&lt;/EM&gt;"&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 12:41:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892542#M352513</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-09-04T12:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need a substitute for "add_months()" teradata function in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892545#M352514</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;I just checked again the the dates are in datetime19. format&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 12:39:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892545#M352514</guid>
      <dc:creator>Coco_08</dc:creator>
      <dc:date>2023-09-04T12:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: Need a substitute for "add_months()" teradata function in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892550#M352517</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/351393"&gt;@Coco_08&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp; yes the current code will pick the values before 5years.the dates present are in timestamp&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So if you have DATETIME values you need to use DT intervals with the INTNX() function to let it know it needs to do the adjustment in SECONDS and not in DAYS.&lt;/P&gt;
&lt;P&gt;If you want to move by years then use the DTYEAR interval.&amp;nbsp; So 5 years before now would be :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;intnx('dtyear',datetime(),-5,'s')&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You might want to express that as a datetime constant.&amp;nbsp; That might allow for faster performance if indexes are involved.&amp;nbsp; To do that use the %SYSFUNC() macro function to call the INTNX() and DATETIME() functions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will generate the datetime value as a number which should work fine in comparisons even if it looks funny to humans.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%sysfunc(intnx(dtyear,%sysfunc(datetime())),-5,s)))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 13:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-substitute-for-quot-add-months-quot-teradata-function-in/m-p/892550#M352517</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-09-04T13:14:09Z</dc:date>
    </item>
  </channel>
</rss>

