<?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: Formatted frequency Table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652711#M196002</link>
    <description>&lt;P&gt;I corrected the counts.&lt;BR /&gt;&lt;BR /&gt;But, I kept the percentages as percentage of row totals, not grand totals.&amp;nbsp; Is that what you want?&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jun 2020 00:32:45 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2020-06-03T00:32:45Z</dc:date>
    <item>
      <title>Formatted frequency Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652651#M195964</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;My problem is relatively simple but i am confused as to what procedure to use. I tried proc freq and proc tabulate but could not accomplish it&lt;/P&gt;&lt;P&gt;Here is my data set:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;This is the table i need:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Variable&lt;/TD&gt;&lt;TD&gt;N(0)&lt;/TD&gt;&lt;TD&gt;0%&lt;/TD&gt;&lt;TD&gt;N(1)&lt;/TD&gt;&lt;TD&gt;1%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&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;B&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;C&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;D&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;Here is my code:&lt;/P&gt;&lt;P&gt;proc tabulate data= gg NOSEPS format=comma11.2;&lt;BR /&gt;class A B C D / missing;&lt;BR /&gt;table (A B C D), (all pctn)/rts=25;&lt;BR /&gt;keylabel&lt;BR /&gt;pctn = '%';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks!!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2020 19:50:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652651#M195964</guid>
      <dc:creator>rajd1</dc:creator>
      <dc:date>2020-06-02T19:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: Formatted frequency Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652652#M195965</link>
      <description>&lt;P&gt;Please explain the four different columns in the output table.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2020 19:41:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652652#M195965</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-06-02T19:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Formatted frequency Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652653#M195966</link>
      <description>Sorry, it is just Frequency and percentage of 0's and 1's by each variable.</description>
      <pubDate>Tue, 02 Jun 2020 19:44:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652653#M195966</guid>
      <dc:creator>rajd1</dc:creator>
      <dc:date>2020-06-02T19:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Formatted frequency Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652660#M195970</link>
      <description>&lt;P&gt;I presume in your percent columns you want row percentages - i.e. percentages in each row sum to 100%.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect this can be done in proc report, but to do it in proc tabulate requires creating an intermediate data set, &amp;nbsp; You want a column for zeroes, and for ones.&amp;nbsp; across A B C and D. &amp;nbsp; So basically you need two new variables ZERO and ONE which you can cross against their occurences in A, B, C, and D.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input A B C D;
datalines;
1 0 1 0
1 0 1 1
1 0 1 0
0 0 1 0
0 1 0 1
run;

data Vneed (keep=vname zero one total) / VIEW=VNEED;    
  set have;
  array var  a b c d;
  do over var;
    vname=vname(var);
    call missing(zero,one);     /*Correction added */
    if var=0 then zero=1; else
    if var=1 then one=1;
    total=1;
    output;
  end;
run;
proc tabulate data=Vneed missing ;
  class vname ;
  var zero one total;
  tables vname=' ', (zero='0' one='1')*(sum='N'*f=3. pctsum&amp;lt;total&amp;gt;='%'*f=5.1) /rts=10;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This create 4 records for each obs in HAVE. &amp;nbsp; It also creates a new variable TOTAL. &amp;nbsp; I did that to use it in the PCTSUM operator in proc tabulate. &amp;nbsp; For each variables A through D, TOTAL sums to the number of rows in the original data set, which is what I need in the denominator of each requested percentage.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other notes, all concerning appearance and formatting of the table.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;the &lt;EM&gt;&lt;STRONG&gt;vname=' '&lt;/STRONG&gt;&lt;/EM&gt;, instead of &lt;EM&gt;&lt;STRONG&gt;vname&lt;/STRONG&gt;&lt;/EM&gt;, is just a way to take the label "VNAME" away from the row title box.&lt;/LI&gt;
&lt;LI&gt;the "/rts=10" tell tabulate to give only 10 columns to the row title.&lt;/LI&gt;
&lt;LI&gt;the zero='0' and one='1'&amp;nbsp; and sum='N' and pctsum&amp;lt;…&amp;gt;='%' just puts desired text in place of ZERO, ONE, SUM, and PCTSUM in the table.&lt;/LI&gt;
&lt;LI&gt;the "f=" component dictate the format of the corresponding cells&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit note:&amp;nbsp; I added the CALL MISSING to make sure an observation was not double counted (i.e. both ZERO and ONE =1).&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 00:31:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652660#M195970</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-06-03T00:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: Formatted frequency Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652663#M195972</link>
      <description>&lt;P&gt;To get the columns you show you need another variable and a different data structure for Tabulate to work with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
 input A	B	C	D;
datalines;
1	0	1	0
1	0	1	1
1	0	1	0
0	0	1	0
0	1	0	1
;

data need;
  set have;
  array v A B C D;
  do i= 1 to dim(v);
      name = vname(v[i]);
      value=v[i];
      output;
  end;
  keep name value;
run;

proc tabulate data=need;
   class name value;
   table name=' ',
         value=' '*(n pctn='%')
         /box='Name'
   ;
run;
&lt;/PRE&gt;
&lt;P&gt;Is as close as I can get.&lt;/P&gt;
&lt;P&gt;Other approaches depending on how the column labels must appear would involve summarizing the data, probably the Need data set and then further reshaping.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2020 20:14:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652663#M195972</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-02T20:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Formatted frequency Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652664#M195973</link>
      <description>This is a great solution. THANK YOU! Just seems like PROC TABULATE might use one extra step to get to the solution. I have been using proc tabulate quite a bit lately.</description>
      <pubDate>Tue, 02 Jun 2020 20:15:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652664#M195973</guid>
      <dc:creator>rajd1</dc:creator>
      <dc:date>2020-06-02T20:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Formatted frequency Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652666#M195974</link>
      <description>This is awesome! Thanks so much!</description>
      <pubDate>Tue, 02 Jun 2020 20:16:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652666#M195974</guid>
      <dc:creator>rajd1</dc:creator>
      <dc:date>2020-06-02T20:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Formatted frequency Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652704#M195998</link>
      <description>&lt;P&gt;I went back and ran this and noticed that the count numbers are off. The counts and percentages for variables B C and D are off. Below is the SAS output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV align="center"&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&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;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;%&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 02 Jun 2020 23:58:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652704#M195998</guid>
      <dc:creator>rajd1</dc:creator>
      <dc:date>2020-06-02T23:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: Formatted frequency Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652705#M195999</link>
      <description>&lt;P&gt;Here is the SAS output: The counts are good but the percentages are off. For example the category 0 for variable A should be 40% and category 1 should be 50%.&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV align="center"&gt;&lt;BR /&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;%&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 02 Jun 2020 23:48:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652705#M195999</guid>
      <dc:creator>rajd1</dc:creator>
      <dc:date>2020-06-02T23:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Formatted frequency Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652706#M196000</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/331278"&gt;@rajd1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;This is a great solution. THANK YOU! Just seems like PROC TABULATE might use one extra step to get to the solution. I have been using proc tabulate quite a bit lately.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Depends on the data whether you need to reshape things.&lt;/P&gt;
&lt;P&gt;I create lots of 0/1 coded variables but I do no report on the 0 and 1 counts. All of the information is contained in the N statistic (number of values), the Sum (is the number of 1's ) and the Mean( is the percentage of 1's). If someone needs the number of 0's then is N - the Sum, if you need the percent of 0's then it is 1- mean.&lt;/P&gt;
&lt;P&gt;Here's an example using a modified data set to have some missing values to see what things might look like:&lt;/P&gt;
&lt;PRE&gt;data have;
 input A	B	C	D;
datalines;
1	0	1	0
1	0	1	1
1	0	1	0
0	0	1	0
0	1	0	1
.  .  1  0
1  .  1  0
;

proc tabulate data=have;
   var A B C D;
   table A B C D,
         n='# Values' sum='# 1' mean='%  1'*f=percent8.1
         /box='Variable'
   ;
run;
&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jun 2020 23:47:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652706#M196000</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-02T23:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: Formatted frequency Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652711#M196002</link>
      <description>&lt;P&gt;I corrected the counts.&lt;BR /&gt;&lt;BR /&gt;But, I kept the percentages as percentage of row totals, not grand totals.&amp;nbsp; Is that what you want?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 00:32:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652711#M196002</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-06-03T00:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Formatted frequency Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652712#M196003</link>
      <description>&lt;P&gt;Yes, that works. I did need the row totals. Thanks so much. I am applying this for 100's of variables. Not sure if this the most efficient way but it works.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 00:45:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652712#M196003</guid>
      <dc:creator>rajd1</dc:creator>
      <dc:date>2020-06-03T00:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Formatted frequency Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652826#M196061</link>
      <description>&lt;P&gt;Make a macro to wrap the following code and go through all the variable name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
  input A B C D;
datalines;
1 0 1 0
1 0 1 1
1 0 1 0
0 0 1 0
0 1 0 1
;
proc sql;
select 'A' as variable,
       sum(A=0) as zero label='N(0)',100*calculated zero/count(*) as z_per label='0 %',
       sum(A=1) as one label='N(1)',100*calculated one/count(*) as z_per label='1 %'
   from have
union 
select 'B' as variable,
       sum(B=0) as zero label='N(0)',100*calculated zero/count(*) as z_per label='0 %',
       sum(B=1) as one label='N(1)',100*calculated one/count(*) as z_per label='1 %'
   from have
union 
select 'C' as variable,
       sum(C=0) as zero label='N(0)',100*calculated zero/count(*) as z_per label='0 %',
       sum(C=1) as one label='N(1)',100*calculated one/count(*) as z_per label='1 %'
   from have
union
select 'D' as variable,
       sum(D=0) as zero label='N(0)',100*calculated zero/count(*) as z_per label='0 %',
       sum(D=1) as one label='N(1)',100*calculated one/count(*) as z_per label='1 %'
   from have
;
quit;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jun 2020 11:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/652826#M196061</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-06-03T11:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Formatted frequency Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/653025#M196118</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/331278"&gt;@rajd1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes, that works. I did need the row totals. Thanks so much. I am applying this for 100's of variables. Not sure if this the most efficient way but it works.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you have 100's of such variables then I strongly suggest you look at my code that doesn't do separate columns for 0/1 but uses summary statistics. Why, you may ask? You can easily use a variable in the code. You haven't really provided any realistic example of your data but any of the list types in SAS will work both on the VAR statement or the the Table statement. Such as&lt;/P&gt;
&lt;P&gt;Var a1-a100 ;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;Var a: b: c: ; to use all of the variables starting with a, b or c.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;If any of your variables have missing values I suggest you test &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;'s solution very carefully.&lt;/P&gt;
&lt;P&gt;Consider this data set:&lt;/P&gt;
&lt;PRE&gt;data have;
  input A B C D;
datalines;
1 0 1 0
1 0 1 1
1 0 1 0
. 0 1 0
. 1 0 1
run;&lt;/PRE&gt;
&lt;P&gt;used with that accepted solution. The Row percentages are going to look odd at best. As will &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;'s though in a slightly different manner. Of course if you have NO missing values for any of the variables you may be okay.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 23:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/653025#M196118</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-03T23:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Formatted frequency Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/653026#M196119</link>
      <description>That makes perfect sense! I will be using this code as well. Thanks a ton!</description>
      <pubDate>Wed, 03 Jun 2020 23:17:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatted-frequency-Table/m-p/653026#M196119</guid>
      <dc:creator>rajd1</dc:creator>
      <dc:date>2020-06-03T23:17:18Z</dc:date>
    </item>
  </channel>
</rss>

