<?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: How to create a table with count/percent/accumulated percent? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/797052#M255823</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt; you've been here long enough to know that we don't have your data, we don't know what it looks like, and we don't know what you think may not be correct. How can we help you if we don't know these things? The first response above, from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;, makes that pretty clear. You're not going to get much help until you provide the information requested.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Feb 2022 20:18:32 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-02-17T20:18:32Z</dc:date>
    <item>
      <title>How to create a table with count/percent/accumulated percent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/796931#M255788</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I would like to create a 10 variable table with the&amp;nbsp;count/percent/accumulated percent, all of the variables are characters.&amp;nbsp; Please let me know how to approach it, thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 17:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/796931#M255788</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2022-02-17T17:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with count/percent/accumulated percent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/796933#M255790</link>
      <description>&lt;P&gt;Please post example data (as usual, data step with datalines) and the expected result (dataset or report)&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 17:34:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/796933#M255790</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-02-17T17:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with count/percent/accumulated percent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/796946#M255795</link>
      <description>&lt;P&gt;Look at PROC FREQ for starters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This can help you get started:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gist.github.com/statgeek/e0903d269d4a71316a4e" target="_blank"&gt;https://gist.github.com/statgeek/e0903d269d4a71316a4e&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
/*This code is an example of how to generate a table with 
Variable Name, Variable Value, Frequency, Percent, Cumulative Freq and Cum Pct
No macro's are required
Use Proc Freq to generate the list, list variables in a table statement if only specific variables are desired
Use ODS Table to capture the output and then format the output into a printable table.
*/

*Run frequency for tables;
ods table onewayfreqs=temp;
proc freq data=sashelp.class;
	table sex age;
run;

*Format output;
data want;
length variable $32. variable_value $50.;
set temp;
Variable=scan(table, 2);

Variable_Value=strip(trim(vvaluex(variable)));

keep variable variable_value frequency percent cum:;
label variable='Variable' 
	variable_value='Variable Value';
run;

*Display;
proc print data=want(obs=20) label;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I would like to create a 10 variable table with the&amp;nbsp;count/percent/accumulated percent, all of the variables are characters.&amp;nbsp; Please let me know how to approach it, thank you.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 18:00:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/796946#M255795</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-02-17T18:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with count/percent/accumulated percent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/797046#M255818</link>
      <description>&lt;P&gt;I generated a code below, not sure whether it's correct.&amp;nbsp; &amp;nbsp;How to list numbers from highest to the lowest?&amp;nbsp; Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=underly1621_nodup;
   tables X1-X10 / out=FreqCount;
run;
proc print data=FreqCount noobs;
   title2 'ARI2016-2021 Underlying Condition count table';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 20:04:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/797046#M255818</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2022-02-17T20:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with count/percent/accumulated percent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/797052#M255823</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt; you've been here long enough to know that we don't have your data, we don't know what it looks like, and we don't know what you think may not be correct. How can we help you if we don't know these things? The first response above, from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;, makes that pretty clear. You're not going to get much help until you provide the information requested.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 20:18:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/797052#M255823</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-02-17T20:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with count/percent/accumulated percent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/797076#M255833</link>
      <description>&lt;P&gt;It's not correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I generated a code below, &lt;STRONG&gt;not sure whether it's correct&lt;/STRONG&gt;.&amp;nbsp; &amp;nbsp;How to list numbers from highest to the lowest?&amp;nbsp; Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=underly1621_nodup;
   tables X1-X10 / out=FreqCount;
run;
proc print data=FreqCount noobs;
   title2 'ARI2016-2021 Underlying Condition count table';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 20:58:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/797076#M255833</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-02-17T20:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with count/percent/accumulated percent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/797085#M255838</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I generated a code below, not sure whether it's correct.&amp;nbsp; &amp;nbsp;How to list numbers from highest to the lowest?&amp;nbsp; Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=underly1621_nodup;
   tables X1-X10 / out=FreqCount;
run;
proc print data=FreqCount noobs;
   title2 'ARI2016-2021 Underlying Condition count table';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Which "numbers"? As a minimum the output data set will contain a count and a percent "number". If you X variables are numeric then those would be as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you may want to look very closely at your FreqCount data set. It likely only has the values for X10. Creating output data sets with the Table statement and an OUT= option will only have the results from the last variable in the list on the tables statement. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; in her post showed how to place the results for multiple variables into an output table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Present something in order: Proc Sort before Proc print.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Freq and the Order=Freq might be appropriate sometimes but we do not know what order you want.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 21:30:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/797085#M255838</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-02-17T21:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with count/percent/accumulated percent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/797208#M255892</link>
      <description>&lt;PRE&gt;proc freq data=sashelp.class noprint;
table sex/out=sex(rename=(sex=level)) outcum;
table name/out=name(rename=(name=level)) outcum;
run;

data want;
length dsn level $ 100;
 set sex name  indsname=indsname;
 dsn=indsname;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Feb 2022 12:39:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/797208#M255892</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-02-18T12:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with count/percent/accumulated percent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/797230#M255902</link>
      <description>Thanks for your help, though I have figured out some functions I could use from previous questions.</description>
      <pubDate>Fri, 18 Feb 2022 14:26:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-table-with-count-percent-accumulated-percent/m-p/797230#M255902</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2022-02-18T14:26:57Z</dc:date>
    </item>
  </channel>
</rss>

