<?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: Append lines to infile in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Append-lines-to-infile/m-p/698181#M213497</link>
    <description>&lt;P&gt;You can't "just append" lines to a HTML file. The file ends with a &amp;lt;/html&amp;gt; directive, and everything after that will be outside the logical HTML data.&lt;/P&gt;
&lt;P&gt;To add content to HTML created by ODS, you neet to use no_bottom_matter in the ODS HTML CLOSE, and after writing content to the file (use a file reference with mod), add another ODS HTML with no_top_matter, and an ordinary ODS HTML CLOSE.&lt;/P&gt;</description>
    <pubDate>Wed, 11 Nov 2020 16:14:39 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-11-11T16:14:39Z</dc:date>
    <item>
      <title>Append lines to infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Append-lines-to-infile/m-p/698168#M213492</link>
      <description>&lt;P&gt;/* Table with email and names */&lt;BR /&gt;DATA NAMES;&lt;BR /&gt;INFILE DATALINES DELIMITER='|';&lt;BR /&gt;FORMAT EMAIL $CHAR23. NAME $CHAR5. CODE $CHAR10.;&lt;BR /&gt;INPUT EMAIL $ NAME $ CODE $;&lt;BR /&gt;DATALINES;&lt;BR /&gt;email.1@test.com|Name1|1111, 2020&lt;BR /&gt;email.2@test.com|Name2|1000, 2026&lt;BR /&gt;email.3@test.com|Name3|1008, 2096&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;/* Emails that will be sent in copy */&lt;BR /&gt;PROC SQL NOPRINT;&lt;BR /&gt;SELECT DISTINCT CAT('"',TRIM(EMAIL),'"') INTO: LISTA SEPARATED BY ' ' FROM NAMES;&lt;BR /&gt;QUIT;&lt;/P&gt;
&lt;P&gt;/* Email */&lt;BR /&gt;%LET DIA=%SYSFUNC(TODAY());&lt;BR /&gt;%LET NDIA=%SYSFUNC(INTNX(DAY,&amp;amp;DIA,-1,B),DDMMYY10.);&lt;/P&gt;
&lt;P&gt;FILENAME REPORT ".../REPORT.html";&lt;BR /&gt;FILENAME CODE&lt;BR /&gt;EMAIL "email@test.com"&lt;BR /&gt;CC=(&amp;amp;LISTA)&lt;BR /&gt;CONTENT_TYPE="text/html"&lt;BR /&gt;SUBJECT="Title &amp;amp;NDIA."&lt;BR /&gt;ATTACH=(".../archive.xlsx" CONTENT_TYPE="application/xlsx");&lt;/P&gt;
&lt;P&gt;/* HTML Report File */&lt;BR /&gt;ODS HTML FILE=REPORT;&lt;BR /&gt;ODS NOPTITLE NOPROCTITLE;&lt;/P&gt;
&lt;P&gt;PROC REPORT DATA=NAMES(DROP=EMAIL) NOWD HEADLINE HEADSKIP&lt;BR /&gt;STYLE (REPORT) = {BACKGROUND = WHITE FONT_SIZE = 8PT&lt;BR /&gt;FONT_FACE = "Calibri" FONT_SIZE = 9PT JUST=LEFT}&lt;/P&gt;
&lt;P&gt;STYLE (COLUMN) = {BACKGROUND = WHITE CELLHEIGHT = 3.5%&lt;BR /&gt;FONT_FACE = "Calibri" FONT_SIZE = 9PT JUST=LEFT}&lt;/P&gt;
&lt;P&gt;STYLE (HEADER) = {FOREGROUND = CXFF8C00 FONT_FACE="Calibri"&lt;BR /&gt;FONT_SIZE = 10PT JUST=LEFT&lt;BR /&gt;BACKGROUND = WHITE} ;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;ODS HTML CLOSE;&lt;/P&gt;
&lt;P&gt;/* HTML edited for me */&lt;BR /&gt;FILENAME ETL '.../ETL.html';&lt;/P&gt;
&lt;P&gt;/* Incorrect */&lt;BR /&gt;DATA _NULL_;&lt;BR /&gt;INFILE ETL;&lt;BR /&gt;FILE ETL2;&lt;BR /&gt;INPUT;&lt;BR /&gt;PUT _INFILE_;&lt;/P&gt;
&lt;P&gt;INFILE REPORT;&lt;BR /&gt;FILE ETL2;&lt;BR /&gt;INPUT;&lt;BR /&gt;PUT _INFILE_;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is something like concatenating files. But the files are in HTML.&lt;BR /&gt;Basically, I want to include a few lines from one HTML file to another while keeping your writing&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2020 15:29:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Append-lines-to-infile/m-p/698168#M213492</guid>
      <dc:creator>a_ramos</dc:creator>
      <dc:date>2020-11-11T15:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Append lines to infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Append-lines-to-infile/m-p/698172#M213494</link>
      <description>&lt;P&gt;It is hard to see the question in the mash of unformatted code.&lt;/P&gt;
&lt;P&gt;But it sounds like you are asking for the MOD option on the FILE statement.&amp;nbsp; With that new lines are written to the end of the file. Without that the file is made new (any existing file is removed/replaced).&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2020 15:45:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Append-lines-to-infile/m-p/698172#M213494</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-11-11T15:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Append lines to infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Append-lines-to-infile/m-p/698181#M213497</link>
      <description>&lt;P&gt;You can't "just append" lines to a HTML file. The file ends with a &amp;lt;/html&amp;gt; directive, and everything after that will be outside the logical HTML data.&lt;/P&gt;
&lt;P&gt;To add content to HTML created by ODS, you neet to use no_bottom_matter in the ODS HTML CLOSE, and after writing content to the file (use a file reference with mod), add another ODS HTML with no_top_matter, and an ordinary ODS HTML CLOSE.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2020 16:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Append-lines-to-infile/m-p/698181#M213497</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-11T16:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: Append lines to infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Append-lines-to-infile/m-p/698707#M213707</link>
      <description>&lt;P&gt;Hi, thanks for responding and for the solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* I used PROC TEMPLATE to remove the original CSS style */&lt;/P&gt;
&lt;P&gt;PROC TEMPLATE;&lt;BR /&gt;DEFINE TAGSET TAGSET.CUSTOM;&lt;BR /&gt;PARENT=TAGSETS.HTML4;&lt;BR /&gt;EMBEDDED_STYLESHEET=OFF;&lt;BR /&gt;END;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Output table for the email body in an HTML file */&lt;/P&gt;
&lt;P&gt;ODS TAGSET.CUSTOM FILE=REPORT;&lt;BR /&gt;ODS NOPTITLE NOPROCTITLE;&lt;/P&gt;
&lt;P&gt;PROC REPORT DATA=NAMES(DROP=EMAIL) NOWD HEADLINE HEADSKIP RUN;&lt;BR /&gt;ODS TAGSET.CUSTOM CLOSE;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* I created a new HTLM file, creating my own CSS style and HTML text using&amp;nbsp; IF _INFILE_ =: '&amp;lt;body' and IF _INFILE_ =: '&amp;lt;head */&lt;/P&gt;
&lt;P&gt;DATA _NULL_;&lt;BR /&gt;INFILE REPORT;&lt;BR /&gt;FILE MSG;&lt;BR /&gt;INPUT;&lt;BR /&gt;PUT _INFILE_;&lt;BR /&gt;IF _INFILE_ =: '&amp;lt;head' THEN DO;&lt;BR /&gt;PUT '&amp;lt;style type="text/css"&amp;gt;&lt;BR /&gt;*,&lt;BR /&gt;*:after,&lt;BR /&gt;*::before {&lt;BR /&gt;-webkit-box-sizing: border-box;&lt;BR /&gt;-moz-box-sizing: border-box;&lt;BR /&gt;box-sizing: border-box;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;body {&lt;BR /&gt;background:#fff;&lt;BR /&gt;color:#000;&lt;BR /&gt;font-family:Verdana,sans-serif;&lt;BR /&gt;margin:0;&lt;BR /&gt;padding:0;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;header {&lt;BR /&gt;border-top: 5px solid #00ff17;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;h1, h2, h3, p{&lt;BR /&gt;font-weight: normal;&lt;BR /&gt;margin:5px 10px;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;h1{&lt;BR /&gt;font-family: Verdana,sans-serif;&lt;BR /&gt;font-size: 1.5em;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;h1.topo {&lt;BR /&gt;padding: 20px 10px;&lt;BR /&gt;text-transform: uppercase;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;p {&lt;BR /&gt;font-size:1em;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;table {&lt;BR /&gt;margin:0 auto;&lt;BR /&gt;width:80%;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;thead{&lt;BR /&gt;color:#17d615;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;table, th, thead{&lt;BR /&gt;border: none;&lt;BR /&gt;background:#282828;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;td {&lt;BR /&gt;border-bottom: 1px solid #282828;&lt;BR /&gt;font-size:0.8em;&lt;BR /&gt;background:#f6f6f6;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;td.r.data {&lt;BR /&gt;text-align: center;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;ul {&lt;BR /&gt;list-style-type: circle;&lt;BR /&gt;font-size:1em;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;lt;/style&amp;gt;';&lt;BR /&gt;END;&lt;/P&gt;
&lt;P&gt;IF _INFILE_ =: '&amp;lt;body' THEN DO;&lt;BR /&gt;PUT '&lt;BR /&gt;&amp;lt;header&amp;gt;&lt;BR /&gt;&amp;lt;h1 class="topo"&amp;gt; LOREM INPSUM DOLOR &amp;lt;/h1&amp;gt;&lt;BR /&gt;&amp;lt;/header&amp;gt;&lt;BR /&gt;&amp;lt;p style="color:#00d318;"&amp;gt;Lorem ipsum dolor sit amet:&amp;lt;/p&amp;gt;&lt;BR /&gt;&amp;lt;ul&amp;gt;&lt;BR /&gt;&amp;lt;li&amp;gt;Consectetur adipiscing elit, sed do eiusmod tempor incididunt;&amp;lt;/li&amp;gt;&lt;BR /&gt;&amp;lt;li&amp;gt;Excepteur sint occaecat cupidatat non proident.&amp;lt;/li&amp;gt;&lt;BR /&gt;&amp;lt;/ul&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;p&amp;gt;Sunt in culpa qui officia deserunt mollit anim id est laborum:&amp;lt;/p&amp;gt;&lt;BR /&gt;&amp;lt;/br&amp;gt;&lt;BR /&gt;';&lt;BR /&gt;END;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Finally, I put the html file as the body of the email */&lt;/P&gt;
&lt;P&gt;DATA _NULL_;&lt;BR /&gt;INFILE MSG;&lt;BR /&gt;FILE CODE;&lt;BR /&gt;INPUT;&lt;BR /&gt;PUT _INFILE_;&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 16:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Append-lines-to-infile/m-p/698707#M213707</guid>
      <dc:creator>a_ramos</dc:creator>
      <dc:date>2020-11-13T16:36:54Z</dc:date>
    </item>
  </channel>
</rss>

