<?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: macro to output put statements into a text file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-to-output-put-statements-into-a-text-file/m-p/268020#M53014</link>
    <description>&lt;P&gt;Thank you, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw﻿&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;This works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you know how to output text in proc sql?&lt;/P&gt;</description>
    <pubDate>Tue, 03 May 2016 18:28:10 GMT</pubDate>
    <dc:creator>fengyuwuzu</dc:creator>
    <dc:date>2016-05-03T18:28:10Z</dc:date>
    <item>
      <title>macro to output put statements into a text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-to-output-put-statements-into-a-text-file/m-p/267990#M53006</link>
      <description>&lt;P&gt;I used %put to call the values of macro variables, and wanted to output some text too.&lt;/P&gt;
&lt;P&gt;I got the outout to the log file, but not the results window, nor to a ODS rtf or pdf file.&lt;/P&gt;
&lt;P&gt;Is there a way to do it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    select count(DUPI) into :all_never
        from demoplay.never_played_all;
    select count(DUPI) into :nj_never
        from demoplay.NJ_never_played;
    select count(DUPI) into :outside_nj
        from demoplay.Outside_NJ_never_played;
quit;&lt;BR /&gt;
%put %str(Total never played: ) %all_never;
%put %str(Total never played in NJ: ) &amp;amp;nj_never;
%put %str(Total never played outside NJ: ) %outside_nj;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 15:53:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-to-output-put-statements-into-a-text-file/m-p/267990#M53006</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-05-03T15:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: macro to output put statements into a text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-to-output-put-statements-into-a-text-file/m-p/267991#M53007</link>
      <description>&lt;P&gt;Why so complicated? Do a simple select in SQL and let ODS route the output.&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 16:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-to-output-put-statements-into-a-text-file/m-p/267991#M53007</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-05-03T16:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: macro to output put statements into a text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-to-output-put-statements-into-a-text-file/m-p/267993#M53009</link>
      <description>Thank you, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;. &lt;BR /&gt;&lt;BR /&gt;I want to output some text too, not only the numbers.</description>
      <pubDate>Tue, 03 May 2016 16:15:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-to-output-put-statements-into-a-text-file/m-p/267993#M53009</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-05-03T16:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: macro to output put statements into a text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-to-output-put-statements-into-a-text-file/m-p/267996#M53010</link>
      <description>&lt;P&gt;Depending on exactly what you want then perhaps use of ODS TEXT is more appropriate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other wise you will need to use something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; file "&amp;lt;desired full path and output file name goes here";&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token macrostatement"&gt;&amp;nbsp;&amp;nbsp; put "&lt;/SPAN&gt;Total never played: &lt;SPAN class="token macroname"&gt;&amp;amp;all_never"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="token macrostatement"&gt;&amp;nbsp;&amp;nbsp; put &lt;/SPAN&gt;"Total never played &lt;SPAN class="token operator"&gt;in&lt;/SPAN&gt; NJ:&amp;nbsp; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;nj_never"&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="token macrostatement"&gt;&amp;nbsp;&amp;nbsp; put&lt;/SPAN&gt; &lt;SPAN class="token macrostatement"&gt;"&lt;/SPAN&gt;Total never played outside NJ:&amp;nbsp; &amp;amp;&lt;SPAN class="token macroname"&gt;outside_nj"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;NOTE: %PUT only writes to the log and you were referencing your macro variable incorrectly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 16:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-to-output-put-statements-into-a-text-file/m-p/267996#M53010</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-05-03T16:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: macro to output put statements into a text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-to-output-put-statements-into-a-text-file/m-p/268020#M53014</link>
      <description>&lt;P&gt;Thank you, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw﻿&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;This works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you know how to output text in proc sql?&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 18:28:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-to-output-put-statements-into-a-text-file/m-p/268020#M53014</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-05-03T18:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: macro to output put statements into a text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-to-output-put-statements-into-a-text-file/m-p/268066#M53032</link>
      <description>&lt;P&gt;You might provide a little more detail of what you are attempting with "output text in proc sql".&lt;/P&gt;
&lt;P&gt;A simple select unless you use the NO print option will direct the Proc SQL output to the active ODS Destination:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc sql;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; select *&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; from SASHELP.CLASS;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Will create a table of output with the contents of the SASHELP.CLASS dataset.&lt;/P&gt;
&lt;P&gt;If I create a phrase variable that would be the result:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   select catx(' ',name,"weighs",weight,"pounds at age",age) as Phrase
   from SASHELP.Class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Will generate something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;&lt;A name="IDX2" target="_blank"&gt;&lt;/A&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="Table" cellspacing="0" cellpadding="3" summary="Procedure SQL: Query Results"&gt;&lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l m Header" scope="col"&gt;Phrase&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Alfred weighs 112.5 pounds at age 14&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Alice weighs 84 pounds at age 13&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Barbara weighs 98 pounds at age 13&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Carol weighs 102.5 pounds at age 14&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Henry weighs 102.5 pounds at age 14&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;James weighs 83 pounds at age 12&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Jane weighs 84.5 pounds at age 12&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Janet weighs 112.5 pounds at age 15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Jeffrey weighs 84 pounds at age 13&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;John weighs 99.5 pounds at age 12&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Joyce weighs 50.5 pounds at age 11&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Judy weighs 90 pounds at age 14&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Louise weighs 77 pounds at age 12&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Mary weighs 112 pounds at age 15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Philip weighs 150 pounds at age 16&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Robert weighs 128 pounds at age 12&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Ronald weighs 133 pounds at age 15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;Thomas weighs 85 pounds at age 11&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l Data"&gt;William weighs 112 pounds at age 15&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 May 2016 20:11:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-to-output-put-statements-into-a-text-file/m-p/268066#M53032</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-05-03T20:11:41Z</dc:date>
    </item>
  </channel>
</rss>

