<?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 tabulate in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate/m-p/414592#M67515</link>
    <description>&lt;P&gt;The log will be your friend in determining what's wrong.&lt;/P&gt;</description>
    <pubDate>Sat, 18 Nov 2017 10:35:21 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-11-18T10:35:21Z</dc:date>
    <item>
      <title>Proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate/m-p/414581#M67512</link>
      <description>&lt;P&gt;Create a work dataset from the TOMHS SAS dataset reading in variables sex, kcalbl, fatbl, probl, chobl, dcholbl, calcbl, sodbl, potbl, and alcbl (use set statement and keep option). The variables after sex are various dietary nutrient intakes calculated from food records collected at baseline. Note: Check attached for the TOMHS SAS dataset dictionary.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Run a PROC CONTENTS on the dataset to display descriptions of each variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using PROC TABULATE generate the following rtf table. When inserted into Word the display should be nearly identical to what is given below. Note: You will need to modify the labels for each nutrient variable to match those in the first column of the table. You will also need to create and apply a format for sex.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Dietary Nutrient Levels at Baseline for TOMHS Men and Women Participants&lt;/EM&gt;&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Please: see attached for the table. It keeps getting altered when copied here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/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p;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Nov 2017 04:56:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate/m-p/414581#M67512</guid>
      <dc:creator>arrytanny</dc:creator>
      <dc:date>2017-11-18T04:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate/m-p/414583#M67513</link>
      <description>&lt;P&gt;You are supposed to solve your homework exercises on your own. That's the whole purpose, isn't it?&lt;/P&gt;
&lt;P&gt;Go through your study material and consult the SAS documentation. If your attempt fails and you are puzzled, post your code and log, and example data in a data step, see here:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Nov 2017 05:51:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate/m-p/414583#M67513</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-11-18T05:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate/m-p/414585#M67514</link>
      <description>&lt;P&gt;Tried a few steps....not getting the proc tabulate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; diets;&lt;/P&gt;&lt;P&gt;infile 'C:\sas\tomhs.dat' ;&lt;/P&gt;&lt;P&gt;input @&lt;STRONG&gt;030&lt;/STRONG&gt; sex &lt;STRONG&gt;1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;@&lt;STRONG&gt;180&lt;/STRONG&gt; kcalbl &lt;STRONG&gt;5.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;@&lt;STRONG&gt;186&lt;/STRONG&gt; fatbl &lt;STRONG&gt;4.1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;@&lt;STRONG&gt;191&lt;/STRONG&gt; probl &lt;STRONG&gt;4.1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;@&lt;STRONG&gt;196&lt;/STRONG&gt; chobl &lt;STRONG&gt;4.1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;@&lt;STRONG&gt;201&lt;/STRONG&gt; dcholbl &lt;STRONG&gt;5.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;@&lt;STRONG&gt;207&lt;/STRONG&gt; calcbl &lt;STRONG&gt;5.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;@&lt;STRONG&gt;213&lt;/STRONG&gt; sodbl &lt;STRONG&gt;5.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;@&lt;STRONG&gt;219&lt;/STRONG&gt; potbl &lt;STRONG&gt;5.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;@&lt;STRONG&gt;225&lt;/STRONG&gt; alcbl &lt;STRONG&gt;4.1&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;LIBNAME mylib 'C:\sas';&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;copy&lt;/STRONG&gt; IN=work OUT=mylib;&lt;/P&gt;&lt;P&gt;select diets;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;LIBNAME mylib 'C:\sas';&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; diets;&lt;/P&gt;&lt;P&gt;set mylib.diets;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;contents&lt;/STRONG&gt; data=diets;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;freq&lt;/STRONG&gt; data=diets;&lt;/P&gt;&lt;P&gt;tables sex;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;means&lt;/STRONG&gt; data=diets N MEAN maxdec=&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;var kcalbl fatbl probl chobl dcholbl calcbl sodbl potbl alcbl;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;tabulate&lt;/STRONG&gt; data=diets format=&lt;STRONG&gt;8.0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;class sex;&lt;/P&gt;&lt;P&gt;var kcalbl fatbl probl chobl dcholbl calcbl sodbl potbl alcbl;&lt;/P&gt;&lt;P&gt;tables sex,ALL='Total';&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Nov 2017 06:35:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate/m-p/414585#M67514</guid>
      <dc:creator>arrytanny</dc:creator>
      <dc:date>2017-11-18T06:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate/m-p/414592#M67515</link>
      <description>&lt;P&gt;The log will be your friend in determining what's wrong.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Nov 2017 10:35:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate/m-p/414592#M67515</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-11-18T10:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate/m-p/414623#M67516</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Here's a crash course in PROC TABULATE:&lt;/P&gt;
&lt;P&gt;1) Every variable used in the TABLE statement must be declared in either a CLASS or VAR statement.&lt;/P&gt;
&lt;P&gt;2) A TABULATE table can have 1, 2 or 3 dimensions.&lt;/P&gt;
&lt;P&gt;3) A comma (,) is used to separate each of the dimensions in the TABLE statement.&lt;/P&gt;
&lt;P&gt;4) The ALL class variable can be used in any dimension to get totals.&lt;/P&gt;
&lt;P&gt;5) To nest or cross variables in the dimensions use the * operator.&lt;/P&gt;
&lt;P&gt;6) To stack variables in the dimensions use the blank operator.&lt;/P&gt;
&lt;P&gt;7) Default statistics are N for class variables and SUM for analysis variables.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; There are other keyword statistics you can use in the TABLE statement (like N, SUM, MEAN, MIN, MAX, etc) to request specific statistics.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's good to have an idea of the table you want to generate and how it looks before you write your TABULATE code. Here's an example:&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;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="proc_tab_example.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16723i8DEB8340B19BF79E/image-size/large?v=v2&amp;amp;px=999" role="button" title="proc_tab_example.png" alt="proc_tab_example.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the above table, which uses the SASHELP.HEART data set, the SEX variable is in the column dimension and nested underneath every unique value for this variable are the N and MEAN statistics. Then, the ALL class variable is used to get the overall N and MEAN columns added at the right in the column dimension.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The analysis variables, AgeAtStart AgeCHDdiag AgeAtDeath Height Weight Cholesterol, are all listed in the ROW dimension. The table shown in the screen shot is called a two-dimension table. There is only 1 comma in the TABLE statement and therefore, there is no PAGE dimension.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this gets you started.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Sat, 18 Nov 2017 17:17:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate/m-p/414623#M67516</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-11-18T17:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate/m-p/414629#M67517</link>
      <description>&lt;P&gt;Thanks Cynthia, this helped.&lt;/P&gt;&lt;P&gt;You are indeed a careful and good teacher...polite personified.&lt;/P&gt;&lt;P&gt;Well done!!! God bless you.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Nov 2017 20:46:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate/m-p/414629#M67517</guid>
      <dc:creator>arrytanny</dc:creator>
      <dc:date>2017-11-18T20:46:56Z</dc:date>
    </item>
  </channel>
</rss>

