<?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: PROC APPEND - trying to suppress FORMAT warnings in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/784390#M250308</link>
    <description>&lt;P&gt;proc append base = table_cible&lt;/P&gt;&lt;P&gt;data = table_source&lt;BR /&gt;force&lt;BR /&gt;;&lt;BR /&gt;format date_abc date_xyz; /* Here, define an empty format for the date variables */&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Dec 2021 20:37:40 GMT</pubDate>
    <dc:creator>Cargo789</dc:creator>
    <dc:date>2021-12-06T20:37:40Z</dc:date>
    <item>
      <title>PROC APPEND - trying to suppress FORMAT warnings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/612988#M178972</link>
      <description>&lt;P&gt;Hi. I'm using a PROC APPEND to insert some records from SAS (originally copied over from SQL Server) into a Postgres table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The source data in SQL Server has non-ASCII characters, so Tom has helped me in a recent thread to load the data into SAS and convert from Latin9 to UTF-8, ready to be inserted into Postgres.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This works fine as long as I use a PROC APPEND, however for each date field I get: WARNING: Variable myDate has format 'DATETIME25.'n on the BASE data set and format 'DATETIME22.'n on the DATA data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think I can fix this properly, as the source and destination are respectively SQL Server and Postgres, and obviously they don't understand what a DATETIME25 is, nor can I change them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I suppress these warnings from the log, as they do not affect the underlying data in any way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 11:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/612988#M178972</guid>
      <dc:creator>EvoluZion3</dc:creator>
      <dc:date>2019-12-19T11:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: PROC APPEND - trying to suppress FORMAT warnings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/612997#M178975</link>
      <description>&lt;P&gt;Specify the format of the variable by using the FORMAT statement inside the call to the APPEND procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data A;
format d datetime22.;
d = '01JAN2020:00:00:00'dt;
run;

data B;
format d datetime25.;
d = '02JAN2020:01:23:45'dt;
run;

proc append base=A data=B; 
format d datetime22.;   /* &amp;lt;== specify the 'base' format */
run;

proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 12:09:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/612997#M178975</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-12-19T12:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: PROC APPEND - trying to suppress FORMAT warnings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/613009#M178981</link>
      <description>&lt;P&gt;Thanks Rick, I can get that code working when I "hard-code" the formats.&lt;/P&gt;
&lt;P&gt;The wider problem I have (which admittedly I haven't elaborated on yet) is that I'm writing a SAS macro function (APPEND_TO_POSTGRES) sharable within my team, so developers/analysts can call my macro to append data across. My macro takes care of the UTF8 conversion etc., and one or two other things which our team may find useful,&amp;nbsp;but obviously there will be different datasets coming in with different formats.&lt;/P&gt;
&lt;P&gt;My current solution then is to use the DICTIONARY table to identify the formats of the fields in the destination table on Postgres, the name of which is&amp;nbsp;passed in as a parameter into my macro, iterate through each field, dynamically build a DATA STEP macro variable similar to that which you posted above, populated with any fields who's format needs to change, and then execute the macro variable.&lt;/P&gt;
&lt;P&gt;I think this will work, but I was hoping there was a more simple solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 12:40:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/613009#M178981</guid>
      <dc:creator>EvoluZion3</dc:creator>
      <dc:date>2019-12-19T12:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: PROC APPEND - trying to suppress FORMAT warnings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/613018#M178984</link>
      <description>&lt;P&gt;Presumably, you know what formats you want for the final data set? If so, a simpler way might be to simply remove all formats until all the data sets are appended. Then &lt;A href="https://go.documentation.sas.com/?docsetId=basess&amp;amp;docsetTarget=n1m4p5okk735vrn183zgkvg17jot.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;use PROC DATASET to set the formats&lt;/A&gt; for the combined data.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 13:01:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/613018#M178984</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-12-19T13:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: PROC APPEND - trying to suppress FORMAT warnings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/613030#M178988</link>
      <description>&lt;P&gt;That's the problem really, I don't. Different developers in my team will be pushing data from different tables from different sources into different Postgres tables, and so the formats could be anything.&lt;/P&gt;
&lt;P&gt;But if I use the DICTIONARY table, I can read the formats of the intended destination tables, and modify the formats&amp;nbsp;of the&amp;nbsp;intermediary SAS table in-flight to match the destination, then I can append without warnings.&lt;/P&gt;
&lt;P&gt;That's the plan.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 13:43:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/613030#M178988</guid>
      <dc:creator>EvoluZion3</dc:creator>
      <dc:date>2019-12-19T13:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: PROC APPEND - trying to suppress FORMAT warnings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/784390#M250308</link>
      <description>&lt;P&gt;proc append base = table_cible&lt;/P&gt;&lt;P&gt;data = table_source&lt;BR /&gt;force&lt;BR /&gt;;&lt;BR /&gt;format date_abc date_xyz; /* Here, define an empty format for the date variables */&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 20:37:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/784390#M250308</guid>
      <dc:creator>Cargo789</dc:creator>
      <dc:date>2021-12-06T20:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: PROC APPEND - trying to suppress FORMAT warnings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/784463#M250344</link>
      <description>&lt;P&gt;If you remove formats before appending, do you still get the warning?&lt;/P&gt;
&lt;P&gt;This way no need to to guess (though I'd hope the Postgres formats follow a norm, so you shouldn't need to guess).&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 04:33:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/784463#M250344</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-12-07T04:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: PROC APPEND - trying to suppress FORMAT warnings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/784520#M250377</link>
      <description>Before the proc append, the dates format are different between variables in the source and target datasets. I don't know if it is possible to remove a format before, but you can redefine them with the same format. To skip the warning messages into then Proc Append, I guess the best way is to remove the format inside the Proc Append.&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Dec 2021 13:55:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-APPEND-trying-to-suppress-FORMAT-warnings/m-p/784520#M250377</guid>
      <dc:creator>Cargo789</dc:creator>
      <dc:date>2021-12-07T13:55:20Z</dc:date>
    </item>
  </channel>
</rss>

