<?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 Proc Tabulate in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate/m-p/677606#M204412</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to proc tabulate by age groups. I formatted my dataset by the following groups:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;value age_cat&lt;BR /&gt;20-39="20&amp;gt;39"&lt;BR /&gt;40-49="40&amp;gt;49"&lt;BR /&gt;50-59="50&amp;gt;59"&lt;BR /&gt;60-200= "&amp;gt;60"&lt;BR /&gt;.="Missing age"&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then put this as my proc tabulate code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;PROC SORT DATA=NHM1514; BY AGE; RUN;&lt;BR /&gt;proc tabulate data=nhm1514;&lt;BR /&gt;CLASS AGE;&lt;BR /&gt;var GENDER smoking martial education diabetes blood_pressure hiv bmi crp SHBG EST TST WBC ORXH06 ORXH11 ORXH16&lt;BR /&gt;ORXH18 ORXH26 ORXH31 ORXH33 ORXH35 ORXH39 ORXH40 ORXH42 ORXH45 ORXH51 ORXH52 ORXH53 ORXH54 ORXH55 ORXH56 ORXH58 ORXH59 ORXH61 ORXH62 ORXH64 ORXH66 ORXH67&lt;BR /&gt;ORXH68 ORXH69 ORXH70 ORXH71 ORXH72 ORXH73 ORXH81 ORXH82 ORXH83 ORXH84 LBDR06 LBDR11 LBDR16 LBDR18 LBDR26 LBDR31 LBDR33 LBDR35 LBDR39 LBDR40 LBDR42 LBDR45&lt;BR /&gt;LBDR51 LBDR52 LBDR53 LBDR54 LBDR55 LBDR56 LBDR58 LBDR59 LBDR61 LBDR62 LBDR64 LBDR66 LBDR67 LBDR68 LBDR69 LBDR70 LBDR71 LBDR72 LBDR73 LBDR81 LBDR82 LBDR83&lt;BR /&gt;LBDR84 LBDR89 HPVP06 HPVP11 HPVP16 HPVP18 HPVP26 HPVP31 HPVP33 HPVP35 HPVP39 HPVP40 HPVP42 HPVP45 HPVP51 HPVP52 HPVP53 HPVP54 HPVP55 HPVP56 HPVP58 HPVP59&lt;BR /&gt;HPVP61 HPVP62 HPVP64 HPVP66 HPVP67 HPVP68 HPVP69 HPVP70 HPVP71 HPVP72 HPVP73 HPVP81 HPVP82 HPVP83 HPVP84 HPVP89;&lt;BR /&gt;table ( GENDER smoking martial education diabetes blood_pressure hiv bmi SHBG EST TST WBC ORXH06 ORXH11 ORXH16&lt;BR /&gt;ORXH18 ORXH26 ORXH31 ORXH33 ORXH35 ORXH39 ORXH40 ORXH42 ORXH45 ORXH51 ORXH52 ORXH53 ORXH54 ORXH55 ORXH56 ORXH58 ORXH59 ORXH61 ORXH62 ORXH64 ORXH66 ORXH67&lt;BR /&gt;ORXH68 ORXH69 ORXH70 ORXH71 ORXH72 ORXH73 ORXH81 ORXH82 ORXH83 ORXH84 LBDR06 LBDR11 LBDR16 LBDR18 LBDR26 LBDR31 LBDR33 LBDR35 LBDR39 LBDR40 LBDR42 LBDR45&lt;BR /&gt;LBDR51 LBDR52 LBDR53 LBDR54 LBDR55 LBDR56 LBDR58 LBDR59 LBDR61 LBDR62 LBDR64 LBDR66 LBDR67 LBDR68 LBDR69 LBDR70 LBDR71 LBDR72 LBDR73 LBDR81 LBDR82 LBDR83&lt;BR /&gt;LBDR84 LBDR89 HPVP06 HPVP11 HPVP16 HPVP18 HPVP26 HPVP31 HPVP33 HPVP35 HPVP39 HPVP40 HPVP42 HPVP45 HPVP51 HPVP52 HPVP53 HPVP54 HPVP55 HPVP56 HPVP58 HPVP59&lt;BR /&gt;HPVP61 HPVP62 HPVP64 HPVP66 HPVP67 HPVP68 HPVP69 HPVP70 HPVP71 HPVP72 HPVP73 HPVP81 HPVP82 HPVP83 HPVP84 HPVP89)*(N MEAN STD pctn), gender ALL;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but then i get 496 error messages on my log:&lt;/P&gt;&lt;DIV class="sasError"&gt;ERROR: There are multiple analysis variables associated with a single table cell in the following nesting : GENDER * N * GENDER.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: There are multiple analysis variables associated with a single table cell in the following nesting : GENDER * Mean * GENDER.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: There are multiple analysis variables associated with a single table cell in the following nesting : GENDER * Std * GENDER.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: There are multiple analysis variables associated with a single table cell in the following nesting : GENDER * PctN * GENDER.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: There are multiple analysis variables associated with a single table cell in the following nesting : SMOKING * N * GENDER.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;Can you help me understand what I am doing wrong and how to appropriately code by variable groups?&lt;/DIV&gt;</description>
    <pubDate>Tue, 18 Aug 2020 19:38:22 GMT</pubDate>
    <dc:creator>RRzio11</dc:creator>
    <dc:date>2020-08-18T19:38:22Z</dc:date>
    <item>
      <title>Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate/m-p/677606#M204412</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to proc tabulate by age groups. I formatted my dataset by the following groups:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;value age_cat&lt;BR /&gt;20-39="20&amp;gt;39"&lt;BR /&gt;40-49="40&amp;gt;49"&lt;BR /&gt;50-59="50&amp;gt;59"&lt;BR /&gt;60-200= "&amp;gt;60"&lt;BR /&gt;.="Missing age"&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then put this as my proc tabulate code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;PROC SORT DATA=NHM1514; BY AGE; RUN;&lt;BR /&gt;proc tabulate data=nhm1514;&lt;BR /&gt;CLASS AGE;&lt;BR /&gt;var GENDER smoking martial education diabetes blood_pressure hiv bmi crp SHBG EST TST WBC ORXH06 ORXH11 ORXH16&lt;BR /&gt;ORXH18 ORXH26 ORXH31 ORXH33 ORXH35 ORXH39 ORXH40 ORXH42 ORXH45 ORXH51 ORXH52 ORXH53 ORXH54 ORXH55 ORXH56 ORXH58 ORXH59 ORXH61 ORXH62 ORXH64 ORXH66 ORXH67&lt;BR /&gt;ORXH68 ORXH69 ORXH70 ORXH71 ORXH72 ORXH73 ORXH81 ORXH82 ORXH83 ORXH84 LBDR06 LBDR11 LBDR16 LBDR18 LBDR26 LBDR31 LBDR33 LBDR35 LBDR39 LBDR40 LBDR42 LBDR45&lt;BR /&gt;LBDR51 LBDR52 LBDR53 LBDR54 LBDR55 LBDR56 LBDR58 LBDR59 LBDR61 LBDR62 LBDR64 LBDR66 LBDR67 LBDR68 LBDR69 LBDR70 LBDR71 LBDR72 LBDR73 LBDR81 LBDR82 LBDR83&lt;BR /&gt;LBDR84 LBDR89 HPVP06 HPVP11 HPVP16 HPVP18 HPVP26 HPVP31 HPVP33 HPVP35 HPVP39 HPVP40 HPVP42 HPVP45 HPVP51 HPVP52 HPVP53 HPVP54 HPVP55 HPVP56 HPVP58 HPVP59&lt;BR /&gt;HPVP61 HPVP62 HPVP64 HPVP66 HPVP67 HPVP68 HPVP69 HPVP70 HPVP71 HPVP72 HPVP73 HPVP81 HPVP82 HPVP83 HPVP84 HPVP89;&lt;BR /&gt;table ( GENDER smoking martial education diabetes blood_pressure hiv bmi SHBG EST TST WBC ORXH06 ORXH11 ORXH16&lt;BR /&gt;ORXH18 ORXH26 ORXH31 ORXH33 ORXH35 ORXH39 ORXH40 ORXH42 ORXH45 ORXH51 ORXH52 ORXH53 ORXH54 ORXH55 ORXH56 ORXH58 ORXH59 ORXH61 ORXH62 ORXH64 ORXH66 ORXH67&lt;BR /&gt;ORXH68 ORXH69 ORXH70 ORXH71 ORXH72 ORXH73 ORXH81 ORXH82 ORXH83 ORXH84 LBDR06 LBDR11 LBDR16 LBDR18 LBDR26 LBDR31 LBDR33 LBDR35 LBDR39 LBDR40 LBDR42 LBDR45&lt;BR /&gt;LBDR51 LBDR52 LBDR53 LBDR54 LBDR55 LBDR56 LBDR58 LBDR59 LBDR61 LBDR62 LBDR64 LBDR66 LBDR67 LBDR68 LBDR69 LBDR70 LBDR71 LBDR72 LBDR73 LBDR81 LBDR82 LBDR83&lt;BR /&gt;LBDR84 LBDR89 HPVP06 HPVP11 HPVP16 HPVP18 HPVP26 HPVP31 HPVP33 HPVP35 HPVP39 HPVP40 HPVP42 HPVP45 HPVP51 HPVP52 HPVP53 HPVP54 HPVP55 HPVP56 HPVP58 HPVP59&lt;BR /&gt;HPVP61 HPVP62 HPVP64 HPVP66 HPVP67 HPVP68 HPVP69 HPVP70 HPVP71 HPVP72 HPVP73 HPVP81 HPVP82 HPVP83 HPVP84 HPVP89)*(N MEAN STD pctn), gender ALL;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but then i get 496 error messages on my log:&lt;/P&gt;&lt;DIV class="sasError"&gt;ERROR: There are multiple analysis variables associated with a single table cell in the following nesting : GENDER * N * GENDER.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: There are multiple analysis variables associated with a single table cell in the following nesting : GENDER * Mean * GENDER.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: There are multiple analysis variables associated with a single table cell in the following nesting : GENDER * Std * GENDER.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: There are multiple analysis variables associated with a single table cell in the following nesting : GENDER * PctN * GENDER.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: There are multiple analysis variables associated with a single table cell in the following nesting : SMOKING * N * GENDER.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;Can you help me understand what I am doing wrong and how to appropriately code by variable groups?&lt;/DIV&gt;</description>
      <pubDate>Tue, 18 Aug 2020 19:38:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate/m-p/677606#M204412</guid>
      <dc:creator>RRzio11</dc:creator>
      <dc:date>2020-08-18T19:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate/m-p/677674#M204440</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/299217"&gt;@RRzio11&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to proc tabulate by age groups. I formatted my dataset by the following groups:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc format;&lt;/P&gt;
&lt;P&gt;value age_cat&lt;BR /&gt;20-39="20&amp;gt;39"&lt;BR /&gt;40-49="40&amp;gt;49"&lt;BR /&gt;50-59="50&amp;gt;59"&lt;BR /&gt;60-200= "&amp;gt;60"&lt;BR /&gt;.="Missing age"&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and then put this as my proc tabulate code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;PROC SORT DATA=NHM1514; BY AGE; RUN;&lt;BR /&gt;proc tabulate data=nhm1514;&lt;BR /&gt;CLASS AGE;&lt;BR /&gt;var GENDER smoking martial education diabetes blood_pressure hiv bmi crp SHBG EST TST WBC ORXH06 ORXH11 ORXH16&lt;BR /&gt;ORXH18 ORXH26 ORXH31 ORXH33 ORXH35 ORXH39 ORXH40 ORXH42 ORXH45 ORXH51 ORXH52 ORXH53 ORXH54 ORXH55 ORXH56 ORXH58 ORXH59 ORXH61 ORXH62 ORXH64 ORXH66 ORXH67&lt;BR /&gt;ORXH68 ORXH69 ORXH70 ORXH71 ORXH72 ORXH73 ORXH81 ORXH82 ORXH83 ORXH84 LBDR06 LBDR11 LBDR16 LBDR18 LBDR26 LBDR31 LBDR33 LBDR35 LBDR39 LBDR40 LBDR42 LBDR45&lt;BR /&gt;LBDR51 LBDR52 LBDR53 LBDR54 LBDR55 LBDR56 LBDR58 LBDR59 LBDR61 LBDR62 LBDR64 LBDR66 LBDR67 LBDR68 LBDR69 LBDR70 LBDR71 LBDR72 LBDR73 LBDR81 LBDR82 LBDR83&lt;BR /&gt;LBDR84 LBDR89 HPVP06 HPVP11 HPVP16 HPVP18 HPVP26 HPVP31 HPVP33 HPVP35 HPVP39 HPVP40 HPVP42 HPVP45 HPVP51 HPVP52 HPVP53 HPVP54 HPVP55 HPVP56 HPVP58 HPVP59&lt;BR /&gt;HPVP61 HPVP62 HPVP64 HPVP66 HPVP67 HPVP68 HPVP69 HPVP70 HPVP71 HPVP72 HPVP73 HPVP81 HPVP82 HPVP83 HPVP84 HPVP89;&lt;BR /&gt;table ( GENDER smoking martial education diabetes blood_pressure hiv bmi SHBG EST TST WBC ORXH06 ORXH11 ORXH16&lt;BR /&gt;ORXH18 ORXH26 ORXH31 ORXH33 ORXH35 ORXH39 ORXH40 ORXH42 ORXH45 ORXH51 ORXH52 ORXH53 ORXH54 ORXH55 ORXH56 ORXH58 ORXH59 ORXH61 ORXH62 ORXH64 ORXH66 ORXH67&lt;BR /&gt;ORXH68 ORXH69 ORXH70 ORXH71 ORXH72 ORXH73 ORXH81 ORXH82 ORXH83 ORXH84 LBDR06 LBDR11 LBDR16 LBDR18 LBDR26 LBDR31 LBDR33 LBDR35 LBDR39 LBDR40 LBDR42 LBDR45&lt;BR /&gt;LBDR51 LBDR52 LBDR53 LBDR54 LBDR55 LBDR56 LBDR58 LBDR59 LBDR61 LBDR62 LBDR64 LBDR66 LBDR67 LBDR68 LBDR69 LBDR70 LBDR71 LBDR72 LBDR73 LBDR81 LBDR82 LBDR83&lt;BR /&gt;LBDR84 LBDR89 HPVP06 HPVP11 HPVP16 HPVP18 HPVP26 HPVP31 HPVP33 HPVP35 HPVP39 HPVP40 HPVP42 HPVP45 HPVP51 HPVP52 HPVP53 HPVP54 HPVP55 HPVP56 HPVP58 HPVP59&lt;BR /&gt;HPVP61 HPVP62 HPVP64 HPVP66 HPVP67 HPVP68 HPVP69 HPVP70 HPVP71 HPVP72 HPVP73 HPVP81 HPVP82 HPVP83 HPVP84 HPVP89)*(N MEAN STD pctn), gender ALL;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but then i get 496 error messages on my log:&lt;/P&gt;
&lt;DIV class="sasError"&gt;ERROR: There are multiple analysis variables associated with a single table cell in the following nesting : GENDER * N * GENDER.&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;ERROR: There are multiple analysis variables associated with a single table cell in the following nesting : GENDER * Mean * GENDER.&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;ERROR: There are multiple analysis variables associated with a single table cell in the following nesting : GENDER * Std * GENDER.&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;ERROR: There are multiple analysis variables associated with a single table cell in the following nesting : GENDER * PctN * GENDER.&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;ERROR: There are multiple analysis variables associated with a single table cell in the following nesting : SMOKING * N * GENDER.&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;Can you help me understand what I am doing wrong and how to appropriately code by variable groups?&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the code you show the only variable that can have the role of a "group" variable is AGE. Any variable on the VAR statement is an analysis variable and will have statistic calculated for it.&lt;/P&gt;
&lt;P&gt;However Proc Tabulate does not allow you to "cross" var varaibles against each other because each needs a statistic and the intent of which is desired is not clear in that case.&lt;/P&gt;
&lt;P&gt;If you want Gender as group variable then 1) remove it from the VAR statement, 2) place it in a CLASS statement, and 3) remove it from the parenthesized variables in the Table statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While VAR variables must be numeric you can use numeric variables as Class variables. A format such as you show is one of the nice ways to create usable categories from a variable with many levels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that you missed a FORMAT age age_cat.; and from your sort you likely intended a BY Age; in proc tabulate as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would suspect that marital and education should more likely be Class variables and if smoking, diabetes and hiv are indicators of history of smoking, have/do not have diabetes or hiv that they are more likely candidates as class variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 02:05:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate/m-p/677674#M204440</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-08-19T02:05:48Z</dc:date>
    </item>
  </channel>
</rss>

