<?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: Problems related to proc tabulate in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problems-related-to-proc-tabulate/m-p/731973#M228073</link>
    <description>&lt;P&gt;Transpose to a long dataset, and let PROC REPORT do the work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data gdp;
infile
  '/folders/myfolders/RealGDP.csv'
  dlm=','
  dsd
  truncover
  firstobs=2
;
input postal :$2. y2012-y2015;
run;

data long;
set gdp;
array y {2012:2015} y2012-y2015;
do year = 2012 to 2015;
  gdp = y{year};
  output;
end;
keep postal year gdp;
run;

proc report data=long;
column postal year,(sum min max),gdp;
define postal / group;
define year / "" across;
define gdp / "" analysis;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 07 Apr 2021 16:21:29 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-04-07T16:21:29Z</dc:date>
    <item>
      <title>Problems related to proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-related-to-proc-tabulate/m-p/731960#M228064</link>
      <description>&lt;P&gt;Hello! I have some questions relating to proc tabulate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the RealGDP data attached, I would like to&amp;nbsp;&lt;SPAN class="textLayer--absolute"&gt;use PROC TABULATE to create a table with the state abbreviations (postal) as the rows and the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="textLayer--absolute"&gt;years (Y2012, Y2013, Y2014, Y2015) as the columns, and&amp;nbsp;a table with the state abbreviations (postal) as the rows and the years (Y2012, Y2013, Y2014, Y2015) as the columns with each years’ minimum, mean, and maximum values. Also, for each table, I need a&amp;nbsp;&lt;SPAN&gt;centered blue footnote with a height of 1 called 'Source: Bureau of Economic Analysis'.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's what I have for now, but it doesn't print out a table, and I'm not sure where to go from this. For your information, I have already imported the original data into "gdp".&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title "Sum of Real GDP by Year";
proc tabulate data=gdp;
  by Postal;
  table Postal, Y2012*Y2013*Y2014*Y2015;
run;
title;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Apr 2021 15:52:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-related-to-proc-tabulate/m-p/731960#M228064</guid>
      <dc:creator>emmad511</dc:creator>
      <dc:date>2021-04-07T15:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problems related to proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-related-to-proc-tabulate/m-p/731972#M228072</link>
      <description>&lt;P&gt;Start with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title "Sum of Real GDP by Year";
proc tabulate data=gdp;
  var Y2012 Y2013 Y2014 Y2015;
  class postal;
  table Postal, (Y2012 Y2013 Y2014 Y2015)*(mean min max);
run;
ods text="Source: Bureau of Economic Analysis";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Apr 2021 16:21:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-related-to-proc-tabulate/m-p/731972#M228072</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2021-04-07T16:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problems related to proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-related-to-proc-tabulate/m-p/731973#M228073</link>
      <description>&lt;P&gt;Transpose to a long dataset, and let PROC REPORT do the work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data gdp;
infile
  '/folders/myfolders/RealGDP.csv'
  dlm=','
  dsd
  truncover
  firstobs=2
;
input postal :$2. y2012-y2015;
run;

data long;
set gdp;
array y {2012:2015} y2012-y2015;
do year = 2012 to 2015;
  gdp = y{year};
  output;
end;
keep postal year gdp;
run;

proc report data=long;
column postal year,(sum min max),gdp;
define postal / group;
define year / "" across;
define gdp / "" analysis;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Apr 2021 16:21:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-related-to-proc-tabulate/m-p/731973#M228073</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-07T16:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Problems related to proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-related-to-proc-tabulate/m-p/732097#M228110</link>
      <description>All classification variables need to be listed in class statement.&lt;BR /&gt;title "Sum of Real GDP by Year";&lt;BR /&gt;proc tabulate data=gdp;&lt;BR /&gt;Class Postal Y2012 Y2013 Y2014 Y2015;&lt;BR /&gt;table Postal, Y2012*Y2013*Y2014*Y2015;&lt;BR /&gt;run;&lt;BR /&gt;Otherwise if Y2012 to Y2015 are quantitative variables, they need to listed under VAR statement.&lt;BR /&gt;proc tabulate data=gdp;&lt;BR /&gt;Class Postal;&lt;BR /&gt;Var Y2012 Y2013 Y2014 Y2015;&lt;BR /&gt;table Postal, (Y2012 Y2013 Y2014 Y2015)*sum='';&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Apr 2021 21:24:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-related-to-proc-tabulate/m-p/732097#M228110</guid>
      <dc:creator>wilson</dc:creator>
      <dc:date>2021-04-07T21:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problems related to proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-related-to-proc-tabulate/m-p/732110#M228119</link>
      <description>&lt;P&gt;Some generic syntax bits in the TABLE statement of Tabulate:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; Commas separate dimensions&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; * nest items&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; (&amp;nbsp;&amp;nbsp; ) group items.&lt;/P&gt;
&lt;P&gt;So if you want the same statistics for multiple variables (var1 var2 var3) * (n mean max &amp;lt;or other valid statistic keywords)&lt;/P&gt;
&lt;P&gt;Grouping variables are CLASS variables and must be declared on a Class statement before use.&lt;/P&gt;
&lt;P&gt;Variables for statistics like Mean, Max, Sum etc must be declared on a VAR statement before use.&lt;/P&gt;
&lt;P&gt;If no specific statistic is requested then you will get N for class variables if there is no interaction (cross or nest) with var variables, and Sum of var variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You must have at least one of a Class or Var statement with at least one variable and ALL variables that appear on the Table statement must be defined as class or var to be used. That is why your code generated a bunch of errors about "type of variablename is unknown"&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 23:11:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-related-to-proc-tabulate/m-p/732110#M228119</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-07T23:11:16Z</dc:date>
    </item>
  </channel>
</rss>

