<?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: PUT statement for html code and Macro result? Possible? in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PUT-statement-for-html-code-and-Macro-result-Possible/m-p/791249#M25579</link>
    <description>&lt;P&gt;What do you think these TWO statements are going to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put '&amp;lt;article&amp;gt;&amp;lt;div&amp;gt;&amp;lt;p&amp;gt;'  %Tabulatethis; 
'&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Expand to see right answer.&lt;/P&gt;
&lt;LI-SPOILER&gt;Any SAS code the macro generates will be inserted into the middle of the PUT statement.&amp;nbsp; So if the first text that the macro generates is PROC TABULATE then your PUT statement will&amp;nbsp; start with:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put '&amp;lt;article&amp;gt;&amp;lt;div&amp;gt;&amp;lt;p&amp;gt;'  PROC TABULATE &lt;/CODE&gt;&lt;/PRE&gt;
Which means write the quoted string followed by the value of the dataset variable named PROC and the dataset variable named TABULATE.&amp;nbsp; Both are probably empty.&amp;nbsp; Plus if the macro generates any semi-colons then the PUT statement will end and those other statements will become part of your DATA step definition.&lt;BR /&gt;&lt;BR /&gt;The second statement after the semi-colon is clearly not a valid SAS statement as it is just a string literal.&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jan 2022 19:53:35 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-01-20T19:53:35Z</dc:date>
    <item>
      <title>PUT statement for html code and Macro result? Possible?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PUT-statement-for-html-code-and-Macro-result-Possible/m-p/791246#M25578</link>
      <description>&lt;P&gt;&lt;STRONG&gt;I have&lt;/STRONG&gt; a proc tabulate in a macro. Which works when run alone. It only creates a simple Tabulate output. I call this macro&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Tabulatethis;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have a data _null_ part with put statements like:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(Which b.t.w. also works fine when run alone without the Macro).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
file reports;

put '&amp;lt;!doctype html&amp;gt;';
put '&amp;lt;style&amp;gt;';
put '* {  box-sizing: border-box; }';
put 'body {  display: flex;  min-height: 100vh;  flex-direction: column;  margin: 0;  color: black } ';
put 'h1 {   color: #001158 }';
put '#main {  display: flex;  flex: 1;}';
put '#main &amp;gt; article {  flex: 1;}';
put '#main &amp;gt; nav, #main &amp;gt; aside {  flex: 0 0 20vw;  background: white;}';
put '#main &amp;gt; nav {  order: -1;}';
put 'footer {  background: #001158;  color: white;  height: 5vh;  font-size: 10px;}';
put 'header, footer, article, nav, aside {  padding: 1em;}';
put '&amp;lt;/style&amp;gt;';

put '&amp;lt;body&amp;gt;';
put '  &amp;lt;header&amp;gt;';
put '  &amp;lt;img src="images/logo.png" alt="LOGO" width="151" height="64"&amp;gt; ';
put '	&amp;lt;h1&amp;gt;&amp;lt;center&amp;gt;Some Title&amp;lt;/center&amp;gt;&amp;lt;/h1&amp;gt;';
put '  &amp;lt;img src="images/G.PNG" alt="G" width="100%" max-width=1180px&amp;gt;';
put '  &amp;lt;/header&amp;gt;';
put '  &amp;lt;div id="main"&amp;gt;';
put '   &amp;lt;article&amp;gt;&amp;lt;div&amp;gt;&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;';
put '	&amp;lt;nav&amp;gt;&amp;lt;/nav&amp;gt;';
put '    &amp;lt;aside&amp;gt;&amp;lt;/aside&amp;gt;';
put '  &amp;lt;/div&amp;gt;';
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I output everything with ODS HTML5 . All works fine. But I can't get the macro results in the HTML page &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;I want:&lt;/STRONG&gt;&lt;BR /&gt;to run the macro and put the output of my macro within&amp;nbsp;&lt;CODE class=" language-sas"&gt;&amp;lt;article&amp;gt;&amp;lt;div&amp;gt;&amp;lt;p&amp;gt;  &lt;STRONG&gt;so here comes the proc tabulate results&lt;/STRONG&gt;  &amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;I Tried&lt;/STRONG&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put '&amp;lt;article&amp;gt;&amp;lt;div&amp;gt;&amp;lt;p&amp;gt;'  &lt;STRONG&gt;%Tabulatethis;&lt;/STRONG&gt; '&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;';
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Can someone please tell me why this is not working for Macro's?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 19:43:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PUT-statement-for-html-code-and-Macro-result-Possible/m-p/791246#M25578</guid>
      <dc:creator>SAS_Question</dc:creator>
      <dc:date>2022-01-20T19:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: PUT statement for html code and Macro result? Possible?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PUT-statement-for-html-code-and-Macro-result-Possible/m-p/791249#M25579</link>
      <description>&lt;P&gt;What do you think these TWO statements are going to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put '&amp;lt;article&amp;gt;&amp;lt;div&amp;gt;&amp;lt;p&amp;gt;'  %Tabulatethis; 
'&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Expand to see right answer.&lt;/P&gt;
&lt;LI-SPOILER&gt;Any SAS code the macro generates will be inserted into the middle of the PUT statement.&amp;nbsp; So if the first text that the macro generates is PROC TABULATE then your PUT statement will&amp;nbsp; start with:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put '&amp;lt;article&amp;gt;&amp;lt;div&amp;gt;&amp;lt;p&amp;gt;'  PROC TABULATE &lt;/CODE&gt;&lt;/PRE&gt;
Which means write the quoted string followed by the value of the dataset variable named PROC and the dataset variable named TABULATE.&amp;nbsp; Both are probably empty.&amp;nbsp; Plus if the macro generates any semi-colons then the PUT statement will end and those other statements will become part of your DATA step definition.&lt;BR /&gt;&lt;BR /&gt;The second statement after the semi-colon is clearly not a valid SAS statement as it is just a string literal.&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 19:53:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PUT-statement-for-html-code-and-Macro-result-Possible/m-p/791249#M25579</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-01-20T19:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: PUT statement for html code and Macro result? Possible?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PUT-statement-for-html-code-and-Macro-result-Possible/m-p/791252#M25580</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;for clearing this up. Now I understand why it keeps getting errors &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So is there any other solution which could work for me?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can I split the data _null_ set? For example:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data _null_;
etc. etc.
put 'first html part till &amp;lt;p&amp;gt;';
run;

/*run the macro: */
%Tabulatethis;

/*then append rest of html? */
Data _null_;
etc. etc.
put 'second html part here';
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or is there anything else which I can do?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 20:01:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PUT-statement-for-html-code-and-Macro-result-Possible/m-p/791252#M25580</guid>
      <dc:creator>SAS_Question</dc:creator>
      <dc:date>2022-01-20T20:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: PUT statement for html code and Macro result? Possible?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PUT-statement-for-html-code-and-Macro-result-Possible/m-p/791261#M25581</link>
      <description>&lt;P&gt;It may be time to clearly state what the objective overall is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have not shared what the macro looks like so we can't tell if the possible split of your data _null_ would work or not. Consider what Tabulate generates. Is the output sent to file, result window, output window? If the macro is generating a plain text file then it MAY work with the data _null_ as proposed.&lt;/P&gt;
&lt;P&gt;If the output of the macro is an HTML(5) file then perhaps you would use a HREF or similar using the URL for the file.&lt;/P&gt;
&lt;P&gt;Possibly PROC Document, which is designed to rearrange SAS output, could be of use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/195211"&gt;@SAS_Question&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;for clearing this up. Now I understand why it keeps getting errors &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So is there any other solution which could work for me?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can I split the data _null_ set? For example:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data _null_;
etc. etc.
put 'first html part till &amp;lt;p&amp;gt;';
run;

/*run the macro: */
%Tabulatethis;

/*then append rest of html? */
Data _null_;
etc. etc.
put 'second html part here';
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or is there anything else which I can do?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 20:30:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PUT-statement-for-html-code-and-Macro-result-Possible/m-p/791261#M25581</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-01-20T20:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: PUT statement for html code and Macro result? Possible?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PUT-statement-for-html-code-and-Macro-result-Possible/m-p/791365#M25582</link>
      <description>&lt;P&gt;This is not the nicest, easiest, or most maintainable way to write HTML!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you'd like to put an end to put statements, you may consider the SASjs framework.&amp;nbsp; We have built a compilation mechanism that lets you embed arbitrary files in SAS programs.&amp;nbsp; Our latest release actually lets you embed binary files also (so you could put images, excel files, or zip files, INSIDE a textual SAS program).&lt;BR /&gt;&lt;BR /&gt;A demo of this is available &lt;A href="https://www.youtube.com/watch?v=KKfUHTngSFo" target="_self"&gt;here.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To make this work for your particular use case:&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;* stick your HTML in the /programs folder&lt;BR /&gt;* add it under the `&amp;lt;h4&amp;gt; SAS Includes &amp;lt;/h4&amp;gt;` program header&lt;BR /&gt;* run `sasjs compile`&lt;BR /&gt;&lt;BR /&gt;It is now automatically wrapped in put statements, with each line no longer than 220 characters in length.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 09:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PUT-statement-for-html-code-and-Macro-result-Possible/m-p/791365#M25582</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2022-01-21T09:31:10Z</dc:date>
    </item>
  </channel>
</rss>

