<?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: Calculate age based on Teradata Birth Date in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Calculate-age-based-on-Teradata-Birth-Date/m-p/865831#M38255</link>
    <description>&lt;P&gt;You are trying to run SAS functions like INTCK and TODAY on a Teradata database. It won't recognise these. Either use Teradata logic or move your SAS functions to SAS SELECT:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CONNECT TO teradata (AUTHDOMAIN=TeradataAuth TDPID=XYZ2 MODE=TERADATA CONNECTION=GLOBAL);
create table want as
select  *
,floor ((intck('month',MBR_BRTH_DT,today()) - (day(today()) &amp;lt; day(MBR_BRTH_DT))) / 12) as age
from connection to Teradata
(
select
DMA.MCID
,frfm.HCC_CD
,DMA.GNDR_NM
,DMA.MBR_BRTH_DT
from ......
);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 23 Mar 2023 01:39:32 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2023-03-23T01:39:32Z</dc:date>
    <item>
      <title>Calculate age based on Teradata Birth Date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculate-age-based-on-Teradata-Birth-Date/m-p/865828#M38254</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;How do I calculate age while using a connection to teradata date of birth field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I tried so far, It is embded&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;CONNECT TO teradata (AUTHDOMAIN=TeradataAuth TDPID=XYZ2 MODE=TERADATA CONNECTION=GLOBAL);&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;select&lt;BR /&gt;DMA.MCID&lt;BR /&gt;,frfm.HCC_CD&lt;BR /&gt;,DMA.GNDR_NM&lt;BR /&gt;,floor ((intck('month',DMA.MBR_BRTH_DT,today()) - (day(today()) &amp;lt; day(DMA.MBR_BRTH_DT))) / 12) as age&lt;BR /&gt;,INCRD_YEAR_MNTH_NBR&lt;BR /&gt;,case when max(PRORTD_MBR_MNTH_CNT) &amp;gt;0 then 1 else 0 END AS PRORTD_MBR_MNTH_CNT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: Teradata prepare: Syntax error: expected something between '(' and the string 'month'.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 01:23:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculate-age-based-on-Teradata-Birth-Date/m-p/865828#M38254</guid>
      <dc:creator>Hdababs</dc:creator>
      <dc:date>2023-03-23T01:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate age based on Teradata Birth Date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculate-age-based-on-Teradata-Birth-Date/m-p/865831#M38255</link>
      <description>&lt;P&gt;You are trying to run SAS functions like INTCK and TODAY on a Teradata database. It won't recognise these. Either use Teradata logic or move your SAS functions to SAS SELECT:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CONNECT TO teradata (AUTHDOMAIN=TeradataAuth TDPID=XYZ2 MODE=TERADATA CONNECTION=GLOBAL);
create table want as
select  *
,floor ((intck('month',MBR_BRTH_DT,today()) - (day(today()) &amp;lt; day(MBR_BRTH_DT))) / 12) as age
from connection to Teradata
(
select
DMA.MCID
,frfm.HCC_CD
,DMA.GNDR_NM
,DMA.MBR_BRTH_DT
from ......
);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Mar 2023 01:39:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculate-age-based-on-Teradata-Birth-Date/m-p/865831#M38255</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-03-23T01:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate age based on Teradata Birth Date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculate-age-based-on-Teradata-Birth-Date/m-p/865857#M38256</link>
      <description>&lt;P&gt;For age calculations, use the&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p1pmmr2dtec32an1vbsqmm3abil5.htm" target="_blank" rel="noopener"&gt;YRDIF&lt;/A&gt;&amp;nbsp;function in SAS code.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 06:59:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculate-age-based-on-Teradata-Birth-Date/m-p/865857#M38256</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-03-23T06:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate age based on Teradata Birth Date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculate-age-based-on-Teradata-Birth-Date/m-p/865923#M38267</link>
      <description>&lt;P&gt;Thank you. I initially posted this as a reply to a resolved post. I was able to use teradata syntax:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;('2022' - extract(year from teradata birth date column name)) as Age&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 13:10:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculate-age-based-on-Teradata-Birth-Date/m-p/865923#M38267</guid>
      <dc:creator>Hdababs</dc:creator>
      <dc:date>2023-03-23T13:10:59Z</dc:date>
    </item>
  </channel>
</rss>

