<?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: Having a fixed set of variables in the column for proc tabulate in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Having-a-fixed-set-of-variables-in-the-column-for-proc-tabulate/m-p/716896#M221642</link>
    <description>Seems like a proc means would be enough?&lt;BR /&gt;&lt;BR /&gt;proc means data=.... MEAN;&lt;BR /&gt;class cluster;&lt;BR /&gt;var &amp;amp;relevant_vars;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Your mean belongs with the stats, not with the cluster. See if this gets you closer.&lt;BR /&gt;&lt;BR /&gt;Proc tabulate data=....;&lt;BR /&gt;class CLUSTER;&lt;BR /&gt;var &amp;amp;relevant_vars;&lt;BR /&gt;table (CLUSTER), (&amp;amp;relevant_vars)*Mean;&lt;BR /&gt;run;</description>
    <pubDate>Thu, 04 Feb 2021 19:33:56 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-02-04T19:33:56Z</dc:date>
    <item>
      <title>Having a fixed set of variables in the column for proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Having-a-fixed-set-of-variables-in-the-column-for-proc-tabulate/m-p/716895#M221641</link>
      <description>&lt;P&gt;I have a list of variables stored in the macro &amp;amp;relevant vars. I want to see the mean value of each of these variables (spread across the columns) grouped by a variable called cluster.&lt;/P&gt;&lt;P&gt;I ran a code as follows :&lt;/P&gt;&lt;PRE&gt;proc tabulate data = work.cluster_data_with_var_pred;
	var CLUSTER;
	table (CLUSTER)*(MEAN), &amp;amp;relevant_vars;
run;&lt;/PRE&gt;&lt;P&gt;It turns out that I cannot have the reference mentioned there. I tried a simple proc means but that creates a messy table where the relevant_vars just repeat rows for each cluster value instead of running across as columns Can anyone help me figure out another way to do this?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 19:31:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Having-a-fixed-set-of-variables-in-the-column-for-proc-tabulate/m-p/716895#M221641</guid>
      <dc:creator>aalluru</dc:creator>
      <dc:date>2021-02-04T19:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Having a fixed set of variables in the column for proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Having-a-fixed-set-of-variables-in-the-column-for-proc-tabulate/m-p/716896#M221642</link>
      <description>Seems like a proc means would be enough?&lt;BR /&gt;&lt;BR /&gt;proc means data=.... MEAN;&lt;BR /&gt;class cluster;&lt;BR /&gt;var &amp;amp;relevant_vars;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Your mean belongs with the stats, not with the cluster. See if this gets you closer.&lt;BR /&gt;&lt;BR /&gt;Proc tabulate data=....;&lt;BR /&gt;class CLUSTER;&lt;BR /&gt;var &amp;amp;relevant_vars;&lt;BR /&gt;table (CLUSTER), (&amp;amp;relevant_vars)*Mean;&lt;BR /&gt;run;</description>
      <pubDate>Thu, 04 Feb 2021 19:33:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Having-a-fixed-set-of-variables-in-the-column-for-proc-tabulate/m-p/716896#M221642</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-02-04T19:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Having a fixed set of variables in the column for proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Having-a-fixed-set-of-variables-in-the-column-for-proc-tabulate/m-p/716899#M221643</link>
      <description>&lt;P&gt;I think what you want to do is this. I just replicated the problem using SASHELP.CLASS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let relevant_vars = height weight;

proc tabulate data = sashelp.class;
   class sex;
   var &amp;amp;relevant_vars;
   table sex, (&amp;amp;relevant_vars)*mean;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture.PNG" style="width: 304px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54329i4FFEACEDB9CC49E1/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 19:38:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Having-a-fixed-set-of-variables-in-the-column-for-proc-tabulate/m-p/716899#M221643</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-02-04T19:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: Having a fixed set of variables in the column for proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Having-a-fixed-set-of-variables-in-the-column-for-proc-tabulate/m-p/716901#M221644</link>
      <description>&lt;P&gt;Oh yes! The proc tabulate you sent worked perfectly. I wanted the variable list to run along the columns, that's why I scrapped the proc means idea. Thank you so much!&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 19:39:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Having-a-fixed-set-of-variables-in-the-column-for-proc-tabulate/m-p/716901#M221644</guid>
      <dc:creator>aalluru</dc:creator>
      <dc:date>2021-02-04T19:39:24Z</dc:date>
    </item>
  </channel>
</rss>

