<?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 report issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-report-issue/m-p/348996#M80886</link>
    <description>&lt;P&gt;Without the transpose we could use the proc report on xy dataset to get the output as below, try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data xy_;
length trt1 $10.;
set xy;
trt1=cats('trt',trt);
run;

proc report data=xy_;
column event (trt1),(num per);
define event /group width=10;
define trt1 / ' ' across order=internal;
define num/ "n" center ;
define per/  "%" center;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Apr 2017 06:46:01 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2017-04-11T06:46:01Z</dc:date>
    <item>
      <title>proc report issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-issue/m-p/348951#M80863</link>
      <description>&lt;P&gt;Below is my code and ouput.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I transposed "xy" dataset into &amp;nbsp;"final" dataset, then used proc report to output.&lt;/P&gt;&lt;P&gt;If anyone know a way to output the data directly from 'xy' datasets with proc report. Thanks.&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;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8255i862CA7EE58C20D61/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="11.jpg" title="11.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;/******CODE*****************************************/&lt;/P&gt;&lt;P&gt;/* Data part**/&lt;/P&gt;&lt;P&gt;data a;&lt;BR /&gt;trt="1"; output;&lt;BR /&gt;trt="2"; output;&lt;BR /&gt;trt="3"; output;&lt;BR /&gt;run;&lt;BR /&gt;data a;&lt;BR /&gt;trt="1"; output;&lt;BR /&gt;trt="2"; output;&lt;BR /&gt;trt="3"; output;&lt;BR /&gt;run;&lt;BR /&gt;data b;&lt;BR /&gt;event="a"; num=2; output;&lt;BR /&gt;event="b"; num=3; output;&lt;BR /&gt;event="c"; num=4; output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table x as&lt;BR /&gt;select a.*, b.*&lt;BR /&gt;from a, b&lt;BR /&gt;order by b.event, a.trt;&lt;/P&gt;&lt;P&gt;create table y as&lt;BR /&gt;select event, sum(num) as total&lt;BR /&gt;from x&lt;BR /&gt;group by event;&lt;/P&gt;&lt;P&gt;create table xy as&lt;BR /&gt;select a.*, b.total, round(a.num/b.total*100,0.1) as per&lt;BR /&gt;from x as a, y as b&lt;BR /&gt;where a.event=b.event&lt;BR /&gt;order by event, trt;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;/*Data part end*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc transpose data=xy out=xy_1 prefix=num;&lt;BR /&gt;by event;&lt;BR /&gt;id trt;&lt;BR /&gt;var num;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc transpose data=xy out=xy_2 prefix=per;&lt;BR /&gt;by event;&lt;BR /&gt;id trt;&lt;BR /&gt;var per;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data final;&lt;BR /&gt;merge xy_1 xy_2;&lt;BR /&gt;by event;&lt;BR /&gt;drop _name_;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ods rtf file= "C:\XXXXX\123.rtf";&lt;BR /&gt;proc report data=final;&lt;BR /&gt;column event ("trt1" (num1 per1)) ("trt2" (num2 per2)) ("trt3" (num3 per3));&lt;BR /&gt;define num:/display "n" center;&lt;BR /&gt;define per:/ display "%" center;&lt;BR /&gt;run;&lt;BR /&gt;ods rtf close;&lt;/P&gt;&lt;P&gt;&amp;nbsp;/****************************************/&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 02:50:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-issue/m-p/348951#M80863</guid>
      <dc:creator>Niugg2010</dc:creator>
      <dc:date>2017-04-11T02:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: proc report issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-issue/m-p/348996#M80886</link>
      <description>&lt;P&gt;Without the transpose we could use the proc report on xy dataset to get the output as below, try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data xy_;
length trt1 $10.;
set xy;
trt1=cats('trt',trt);
run;

proc report data=xy_;
column event (trt1),(num per);
define event /group width=10;
define trt1 / ' ' across order=internal;
define num/ "n" center ;
define per/  "%" center;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 06:46:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-issue/m-p/348996#M80886</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-04-11T06:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: proc report issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-issue/m-p/349888#M81266</link>
      <description>&lt;P&gt;Thanks. It works.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 21:47:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-issue/m-p/349888#M81266</guid>
      <dc:creator>Niugg2010</dc:creator>
      <dc:date>2017-04-13T21:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: proc report issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-issue/m-p/349925#M81291</link>
      <description>Thanks, &lt;BR /&gt;Could I request you to please mark this answer correct, it will help everyone in the community to quickly point to the best answers.</description>
      <pubDate>Fri, 14 Apr 2017 00:53:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-issue/m-p/349925#M81291</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-04-14T00:53:29Z</dc:date>
    </item>
  </channel>
</rss>

