<?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: Output Proc Tabulate dataset exactly as it appears in SAS Report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Output-Proc-Tabulate-dataset-exactly-as-it-appears-in-SAS-Report/m-p/663542#M198092</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37602"&gt;@ebowen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could try to use PROC REPORT with the OUT= option instead of PROC TABULATE to have an output consistent with the report.&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
    <pubDate>Fri, 19 Jun 2020 16:25:34 GMT</pubDate>
    <dc:creator>ed_sas_member</dc:creator>
    <dc:date>2020-06-19T16:25:34Z</dc:date>
    <item>
      <title>Output Proc Tabulate dataset exactly as it appears in SAS Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-Proc-Tabulate-dataset-exactly-as-it-appears-in-SAS-Report/m-p/663528#M198088</link>
      <description>&lt;P&gt;Hello all! Is it possible to output the results of PROC TABULATE to a SAS dataset exactly how it appears on the SAS Report? When I use the out= statement, SAS outputs the data with the "across" variables (year in this case) in long format, giving me two observations for each class variable, which is not what I want. I have also tried using ODS Output statement, which outputs them the same way. If I output them to excel or csv, the output looks fine, but it's very cumbersome to have to reimport the data from those sources.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods output table=test1;
proc tabulate data=lq3;
class region clustercode clustername year;
var employment_R employment_US 
	Employ_tot_R Employ_tot_US 
	income_R income_US
	Establish_R Establish_US;
table region='',clustercode=''*clustername='',
	((employment_R employment_US Employ_tot_R Employ_tot_US 
	income_R income_US Establish_R Establish_US)*year=''*sum='' (employment_R employment_US)*pctsum='');
run;
ods output close;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Jun 2020 15:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-Proc-Tabulate-dataset-exactly-as-it-appears-in-SAS-Report/m-p/663528#M198088</guid>
      <dc:creator>ebowen</dc:creator>
      <dc:date>2020-06-19T15:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Output Proc Tabulate dataset exactly as it appears in SAS Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-Proc-Tabulate-dataset-exactly-as-it-appears-in-SAS-Report/m-p/663530#M198089</link>
      <description>No, you need to use PROC TRANSPOSE after on the OUT data set to get the data formatted and its not always possible. However, you can pipe the output directly to Excel, Word or PDF if that's an alternate solution?</description>
      <pubDate>Fri, 19 Jun 2020 15:59:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-Proc-Tabulate-dataset-exactly-as-it-appears-in-SAS-Report/m-p/663530#M198089</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-06-19T15:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: Output Proc Tabulate dataset exactly as it appears in SAS Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-Proc-Tabulate-dataset-exactly-as-it-appears-in-SAS-Report/m-p/663535#M198090</link>
      <description>&lt;P&gt;You have to look at the _type_ variable as a minimum, and possibly the _page_ to tell which combination of elements are represented by any given record.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without knowing exactly what you want to do with the data set it is hard to make further suggestions.&lt;/P&gt;
&lt;P&gt;I do use proc tabulate occasionally to create data sets but for most uses there needs to be significant data manipulation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on what you need you might consider Proc Summary to create the data set but you would still need to look at _type_ variables to get the desired combinations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2020 16:04:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-Proc-Tabulate-dataset-exactly-as-it-appears-in-SAS-Report/m-p/663535#M198090</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-19T16:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Output Proc Tabulate dataset exactly as it appears in SAS Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-Proc-Tabulate-dataset-exactly-as-it-appears-in-SAS-Report/m-p/663542#M198092</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37602"&gt;@ebowen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could try to use PROC REPORT with the OUT= option instead of PROC TABULATE to have an output consistent with the report.&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2020 16:25:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-Proc-Tabulate-dataset-exactly-as-it-appears-in-SAS-Report/m-p/663542#M198092</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-06-19T16:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: Output Proc Tabulate dataset exactly as it appears in SAS Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-Proc-Tabulate-dataset-exactly-as-it-appears-in-SAS-Report/m-p/663545#M198094</link>
      <description>Yeah, I've tried using TRANSPOSE, but it's also pretty cumbersome. From what I understand, with multiple variables I have to transpose each one separately and then merge them all back together. Or do a data step with arrays. Anyway, I'll pursue one of these other options.</description>
      <pubDate>Fri, 19 Jun 2020 16:34:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-Proc-Tabulate-dataset-exactly-as-it-appears-in-SAS-Report/m-p/663545#M198094</guid>
      <dc:creator>ebowen</dc:creator>
      <dc:date>2020-06-19T16:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Output Proc Tabulate dataset exactly as it appears in SAS Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-Proc-Tabulate-dataset-exactly-as-it-appears-in-SAS-Report/m-p/663546#M198095</link>
      <description>Thank you. I haven't worked in PROC REPORT as much, so I'm not as familiar with it. But I think this may be the best way to go.</description>
      <pubDate>Fri, 19 Jun 2020 16:36:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-Proc-Tabulate-dataset-exactly-as-it-appears-in-SAS-Report/m-p/663546#M198095</guid>
      <dc:creator>ebowen</dc:creator>
      <dc:date>2020-06-19T16:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Output Proc Tabulate dataset exactly as it appears in SAS Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-Proc-Tabulate-dataset-exactly-as-it-appears-in-SAS-Report/m-p/663548#M198096</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37602"&gt;@ebowen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is quite difficult without the data but maybe you could try to start with something like this to adapt the code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=lq3 out=want (drop=_break_);
	
	by region;
	
	columns  clustercode clustername employment_R, year employment_US, year 
		Employ_tot_R, year Employ_tot_US, year income_R, year income_US, year Establish_R, year 
		Establish_US, year employment_R, pctsum employment_US, pctsum;
	
	define clustercode/group '';
	define clustername/group '';
	define year / across '';

run;&lt;BR /&gt;&lt;BR /&gt;proc&amp;nbsp;print&amp;nbsp;data=want&lt;/CODE&gt;;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;- The page dimension of your PROC TABULATE (= by region) can be handled with a BY statement&lt;/P&gt;
&lt;P&gt;- The row dimension can be handle with the GROUP option in define statements (cluster code, cluster name)&lt;/P&gt;
&lt;P&gt;- The year can be define as an ACROSS variable to obtain as many column as years for each variable (stack under them).&lt;/P&gt;
&lt;P&gt;- For analysis variables (numeric ones), the default statistic is SUM. For the last two ones, you can request PCTSUM by adding this statistic after a comma.&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2020 16:43:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-Proc-Tabulate-dataset-exactly-as-it-appears-in-SAS-Report/m-p/663548#M198096</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-06-19T16:43:42Z</dc:date>
    </item>
  </channel>
</rss>

