<?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: Creating PROC REPORT using  BY statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/465085#M118603</link>
    <description>&lt;P&gt;Some example data and maybe the code you are attempting that does a single country would be very helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 25 May 2018 14:36:59 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-05-25T14:36:59Z</dc:date>
    <item>
      <title>Creating PROC REPORT using  BY statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/464993#M118572</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create a large demographic table by each country.&lt;/P&gt;&lt;P&gt;Wondering if there is a way to create a table using 'by statement' and changing the first column name as per the country?&lt;/P&gt;&lt;P&gt;at the moment I am running the proc report 20 times (20 countries) and changing the column name manually?&lt;/P&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 09:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/464993#M118572</guid>
      <dc:creator>Sami1234</dc:creator>
      <dc:date>2018-05-25T09:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating PROC REPORT using  BY statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/464996#M118573</link>
      <description>&lt;P&gt;Its generally a good idea to have the title or pre-text as the group, not the column name.&amp;nbsp; E.g.&lt;/P&gt;
&lt;PRE&gt;proc report data...;
  by country;
  title "Country: #byval1";
...
run;&lt;/PRE&gt;
&lt;P&gt;I don't think byval works in label statement, but you can try it:&lt;/P&gt;
&lt;PRE&gt;proc report data...;
  by country;
  define country / label="#byval1";
...
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not you will need to do it by code generation:&lt;/P&gt;
&lt;PRE&gt;proc sort data=have out=loop nodupkey;
  by country;
run;
data _null_;
  set loop;
  call execute(cats('proc report...; where country="',country,'"; define country / label="',country,'"; run;'));
run;&lt;/PRE&gt;
&lt;P&gt;However I really suggest you change your report spec as changing column names isn't good.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 09:07:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/464996#M118573</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-25T09:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: Creating PROC REPORT using  BY statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/464998#M118575</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;As per output requirement, I've to create one large report with by country title and then the first columns ' label (which has all the demo variables names) will show the country name.&lt;/P&gt;&lt;P&gt;I will try the above solution and let you know then &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; thanks&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 09:17:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/464998#M118575</guid>
      <dc:creator>Sami1234</dc:creator>
      <dc:date>2018-05-25T09:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: Creating PROC REPORT using  BY statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/465043#M118592</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I tried both methods and they are not working.&lt;/P&gt;&lt;P&gt;The second method is not very clear to me. where do I need to put where statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 13:03:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/465043#M118592</guid>
      <dc:creator>Sami1234</dc:creator>
      <dc:date>2018-05-25T13:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating PROC REPORT using  BY statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/465047#M118594</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;they are not working." - this does not tell us anything.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This line:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;  call execute(cats('proc report...; where country="',country,'"; define country / label="',country,'"; run;'));&lt;/PRE&gt;
&lt;P&gt;Creates a proc report step for each unique country as defined in the dataset loop.&amp;nbsp; The where is part of that.&lt;/P&gt;
&lt;P&gt;I have no idea of what you have - no test data in the form of a datastep, nor what you want output, so its hard to provide any guidance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 13:16:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/465047#M118594</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-25T13:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating PROC REPORT using  BY statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/465067#M118599</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to run a demographic table by country and the variable 'country' should not&amp;nbsp;be in the report, the country is only showing it&amp;nbsp;as one of the variable's label.&lt;/P&gt;&lt;P&gt;Somehow call execute is throwing errors about where statement and missing brackets, wondering any other way to create report?&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 14:03:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/465067#M118599</guid>
      <dc:creator>Sami1234</dc:creator>
      <dc:date>2018-05-25T14:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating PROC REPORT using  BY statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/465068#M118600</link>
      <description>&lt;P&gt;would it be possible to use do until(endoffile) or macro to run till end of file?&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 14:06:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/465068#M118600</guid>
      <dc:creator>Sami1234</dc:creator>
      <dc:date>2018-05-25T14:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating PROC REPORT using  BY statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/465070#M118601</link>
      <description>&lt;P&gt;If you don't want country to show then set it as noprint:&lt;/P&gt;
&lt;PRE&gt;proc report data...;
  by country;
  title "Country: #byval1";&lt;BR /&gt;  columns _all_;&lt;BR /&gt;  define country / noprint;
...
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 14:12:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/465070#M118601</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-25T14:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Creating PROC REPORT using  BY statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/465085#M118603</link>
      <description>&lt;P&gt;Some example data and maybe the code you are attempting that does a single country would be very helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 14:36:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/465085#M118603</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-05-25T14:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Creating PROC REPORT using  BY statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/465092#M118605</link>
      <description>&lt;P&gt;Proc report data=test;&lt;/P&gt;&lt;P&gt;column country allgrp&amp;nbsp;trt1 trt2 trt3 trt4 total;&lt;/P&gt;&lt;P&gt;define allgrp&amp;nbsp;/ 'country' ;&lt;/P&gt;&lt;P&gt;I would like to see the allgrp&amp;nbsp;label as a country?&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 14:49:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-PROC-REPORT-using-BY-statement/m-p/465092#M118605</guid>
      <dc:creator>Sami1234</dc:creator>
      <dc:date>2018-05-25T14:49:22Z</dc:date>
    </item>
  </channel>
</rss>

