<?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: Evaluate the field based on formats. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-the-field-based-on-formats/m-p/796483#M255591</link>
    <description>&lt;P&gt;These ID's are most likely stored as character in Teradata, so you should fetch them as-is without reformatting.&lt;/P&gt;
&lt;P&gt;Once you have sample data in SAS, convert them to a data step with datalines and post that here, so we can see what is exactly in there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also do not think that your SQL queries will work at all, as the explicit pass-through queries do not deliver a variable clmnt_bth_dt.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Feb 2022 08:54:43 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-02-16T08:54:43Z</dc:date>
    <item>
      <title>Evaluate the field based on formats.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-the-field-based-on-formats/m-p/796467#M255584</link>
      <description>&lt;P&gt;hi ,&lt;/P&gt;
&lt;P&gt;Formatted CL_ID as z20 instead of z21 for possible overlap of the EC data from the CR data.&lt;BR /&gt;how can&amp;nbsp; CL_ID I may&amp;nbsp; evaluate ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the below is just a sample code :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
     CONNECT TO TERADATA (user="&amp;amp;TDUser" password="&amp;amp;TDPass" server="&amp;amp;TDServer");
     create table tableA  as  
     select *,
          clmnt_bth_dt as BIRTH_DT length=4 format=mmddyy10. 
          from connection to teradata
          (SELECT
         		 a.cl_id (FORMAT 'z(21)') (char(21)) AS CL_ID, 
         		b.sbscr_ssn
				from EC.claim a
                   LEFT JOIN
               EC.subscriber b
          on (a.sbscr_id=b.sbscr_id))
;
quit;


proc sql;
   CONNECT TO TERADATA (user="&amp;amp;TDUser" password="&amp;amp;TDPass" server="&amp;amp;TDServer");
   create table tableB as  
   select *,
          clmnt_bth_dt as BIRTH_DT length=4 format=mmddyy10. 
   from connection to teradata
      (SELECT a.mbr_id (FORMAT 'z(20)') (char(20)) as cl_id, 
             
              b.sbscr_nbr as SBSCR_ID 
       from CR.MEMBER a
        LEFT JOIN 
                   from CR.MEMBERSHIP_FACT b
         on (a.mbr_ky = b.mbr_ky)
       );
   quit;

/**************************************************************
* Now combine 
**************************************************************/
proc append data=tableB base=tableA; run;&lt;/PRE&gt;
&lt;P&gt;sample data format :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="190"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="190"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;STRONG&gt;EC data&amp;nbsp;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;CL_ID&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;9000055081302001&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;10698794602001&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;9000746632802002&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;10515343302001&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;STRONG&gt;mbr id as cl_id -- from CR&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;mbr_id&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;549041585390&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;116199788665&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;116199788732&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;116199794904&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;116199794902&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 06:56:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluate-the-field-based-on-formats/m-p/796467#M255584</guid>
      <dc:creator>librasonali</dc:creator>
      <dc:date>2022-02-16T06:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate the field based on formats.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-the-field-based-on-formats/m-p/796483#M255591</link>
      <description>&lt;P&gt;These ID's are most likely stored as character in Teradata, so you should fetch them as-is without reformatting.&lt;/P&gt;
&lt;P&gt;Once you have sample data in SAS, convert them to a data step with datalines and post that here, so we can see what is exactly in there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also do not think that your SQL queries will work at all, as the explicit pass-through queries do not deliver a variable clmnt_bth_dt.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 08:54:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluate-the-field-based-on-formats/m-p/796483#M255591</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-02-16T08:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate the field based on formats.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Evaluate-the-field-based-on-formats/m-p/796559#M255627</link>
      <description>&lt;P&gt;Can you explain what you are trying to do?&amp;nbsp; That teradata SQL looks very strange.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How is the variable defined in TERADATA?&amp;nbsp; If it is a number of some type (unlike SAS in TERADATA there are multiple types of numbers) and it is longer than 15 digits then CAST it as a string to avoid loss of precision.&amp;nbsp; SAS stores all numbers as 64 bit binary floating point.&amp;nbsp; So the maximum contiguous integer value that can be stored has only 16 digits.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;662   data _null_;
663     max=constant('exactint');
664     put max= comma30.;
665   run;

max=9,007,199,254,740,992
&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Feb 2022 14:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Evaluate-the-field-based-on-formats/m-p/796559#M255627</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-16T14:07:20Z</dc:date>
    </item>
  </channel>
</rss>

