<?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: How to change formats within a PROC SQL INSERT statement? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-formats-within-a-PROC-SQL-INSERT-statement/m-p/455646#M115299</link>
    <description>&lt;P&gt;You're changing TYPES not FORMATS (different meaning in SAS).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use INPUT() to convert character to numeric and PUT() to convert numeric to character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;input(from_dt, yymmdd10.) as from_dt format = date9.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Apr 2018 15:25:41 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-04-19T15:25:41Z</dc:date>
    <item>
      <title>How to change formats within a PROC SQL INSERT statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-formats-within-a-PROC-SQL-INSERT-statement/m-p/455643#M115297</link>
      <description>&lt;P&gt;Hello SAS Community,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to insert some, but not all, columns from a SAS dataset into a Teradata table with the following statement below.&amp;nbsp; I'm receiving the following error message.&amp;nbsp; Is it possible to change the datatypes of columns from a SAS dataset to match those of the destination columns in a Teradata table when inserting?&amp;nbsp; I've tried numerous ways of doing this without success.&amp;nbsp; I tried a statement like this put(input(From_Dt,mmddyy10.),mmddyy10.); but even getting that changed to a datatype resembling the format found in TD did not work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to match the data types within the INSERT statement and avoid an extra preceding step to change the formats to match those in the TD table.&amp;nbsp; I am using Base SAS 9.4 and Teradata v 15.10.&amp;nbsp; I apologize if this is overly simple or rudimentary but I can't find an example of this scenario anywhere and I have been stuck a long time.&amp;nbsp; Any assistance you can lend would be greatly appreciated.&amp;nbsp; Many thanks in advance for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Value 1 on the SELECT clause does not match the data type of the corresponding column listed after the INSERT table name.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ERROR: Value&amp;nbsp;2 on the SELECT clause does not match the data type of the corresponding column listed after the INSERT table name.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ERROR: Value&amp;nbsp;4 on the SELECT clause does not match the data type of the corresponding column listed after the INSERT table name.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ERROR: Value&amp;nbsp;7 on the SELECT clause does not match the data type of the corresponding column listed after the INSERT table name.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;rsubmit;&lt;BR /&gt;proc sql noerrorstop;&lt;BR /&gt;connect to teradata (user="&amp;amp;xxxxxxx" password="&amp;amp;yyyyyyy" tdpid='xxxxxxxxxxxxxxx' schema='xxxxxxxx' mode=teradata);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;INSERT INTO&amp;nbsp;DB.TABLE (&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;REPORTING_START_DT&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/* &lt;SPAN&gt;Shows as DATE FORMAT 'yyyy-mm-dd'&lt;/SPAN&gt;&amp;nbsp;in Teradata table */&lt;BR /&gt;,REPORTING_END_DT&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/* &lt;SPAN&gt;Shows as DATE FORMAT 'yyyy-mm-dd'&lt;/SPAN&gt;&amp;nbsp;in Teradata table */&lt;BR /&gt;,PROGRAM_NM&lt;BR /&gt;,TIN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/*&amp;nbsp;&lt;SPAN&gt;Shows as&amp;nbsp;&lt;/SPAN&gt;DECIMAL(9,0) in Teradata table&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;BR /&gt;,ACCT_NBR&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;,ACCT_PRDCT_CD&lt;BR /&gt;,ACCT_CO_NBR&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* &lt;SPAN&gt;Shows as&amp;nbsp;&lt;/SPAN&gt;SMALLINT &lt;SPAN&gt;in Teradata table&amp;nbsp;&lt;/SPAN&gt;*/&lt;BR /&gt;,ZONEID_1&lt;BR /&gt;,RF1)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;SELECT&lt;BR /&gt;&amp;nbsp;From_Dt&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;/* Shows as $12. (03/01/2018) in SAS dataset */&lt;/SPAN&gt;&lt;BR /&gt;,To_Dt&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* &lt;SPAN&gt;Shows as&amp;nbsp;&lt;/SPAN&gt;$12.&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;(03/31/2018)&lt;/SPAN&gt; in SAS dataset */&lt;BR /&gt;,'Lab Monitoring' AS PROGRAM_NM&lt;BR /&gt;,TIN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/* Shows as $9. in SAS dataset&amp;nbsp; &amp;nbsp; */&lt;BR /&gt;,Acct_Num&amp;nbsp;&lt;BR /&gt;,Product_Code&lt;BR /&gt;,COID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/* Shows as $3. in SAS dataset&amp;nbsp; &amp;nbsp; */&lt;BR /&gt;, 0 AS ZoneID_1&lt;BR /&gt;,-1 AS RF1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from SAS_dataset;&lt;BR /&gt;&lt;BR /&gt;DISCONNECT FROM TERADATA;&lt;BR /&gt;QUIT;&lt;BR /&gt;ENDRSUBMIT;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 15:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-formats-within-a-PROC-SQL-INSERT-statement/m-p/455643#M115297</guid>
      <dc:creator>esvenson</dc:creator>
      <dc:date>2018-04-19T15:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to change formats within a PROC SQL INSERT statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-formats-within-a-PROC-SQL-INSERT-statement/m-p/455645#M115298</link>
      <description>&lt;P&gt;Is the problem with dates only ?&lt;/P&gt;
&lt;P&gt;SAS dates are numeric containing teh days passedsince 01/01/1960.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tried:&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;put(From_Dt ,mmddyy10.);&lt;/SPAN&gt;&lt;/STRONG&gt;&amp;nbsp; assuming that mm/dd/yyyy is a teradata literal format,&lt;/P&gt;
&lt;P&gt;otherwise replace the&amp;nbsp;&lt;STRONG&gt;mmddyy10.&lt;/STRONG&gt; format to an appropriate format to be read by teradata sql.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 15:19:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-formats-within-a-PROC-SQL-INSERT-statement/m-p/455645#M115298</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-04-19T15:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to change formats within a PROC SQL INSERT statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-formats-within-a-PROC-SQL-INSERT-statement/m-p/455646#M115299</link>
      <description>&lt;P&gt;You're changing TYPES not FORMATS (different meaning in SAS).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use INPUT() to convert character to numeric and PUT() to convert numeric to character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;input(from_dt, yymmdd10.) as from_dt format = date9.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 15:25:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-formats-within-a-PROC-SQL-INSERT-statement/m-p/455646#M115299</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-19T15:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to change formats within a PROC SQL INSERT statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-formats-within-a-PROC-SQL-INSERT-statement/m-p/455647#M115300</link>
      <description>&lt;P&gt;When I try this to test that approach,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;set test_1&lt;/P&gt;&lt;P&gt;From_Dt_Test = put(From_Dt,mmddyy10.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it returns this ERROR 48-59: The format $MMDDYY was not found or could not be loaded.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 15:26:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-formats-within-a-PROC-SQL-INSERT-statement/m-p/455647#M115300</guid>
      <dc:creator>esvenson</dc:creator>
      <dc:date>2018-04-19T15:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to change formats within a PROC SQL INSERT statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-formats-within-a-PROC-SQL-INSERT-statement/m-p/455650#M115302</link>
      <description>&lt;P&gt;It should be INPUT, not PUT&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 15:40:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-formats-within-a-PROC-SQL-INSERT-statement/m-p/455650#M115302</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-19T15:40:45Z</dc:date>
    </item>
  </channel>
</rss>

