<?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 do complex(ish) calculations with variable frequencies/percentages? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-complex-ish-calculations-with-variable-frequencies/m-p/168555#M264037</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Those are the observation numbers. The calculation will look like this, filling in the frequencies for the observation numbers:&lt;/P&gt;&lt;P&gt;(511+859)/(14+1057+511+859) = 1370/2441 = 0.5612&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to automate that calculation so that I can export it and any other calculations into another dataset?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 May 2014 13:50:41 GMT</pubDate>
    <dc:creator>lynnem</dc:creator>
    <dc:date>2014-05-22T13:50:41Z</dc:date>
    <item>
      <title>How to do complex(ish) calculations with variable frequencies/percentages?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-complex-ish-calculations-with-variable-frequencies/m-p/168553#M264035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a dataset that gives scores for each individual:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Cat1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Cat 2&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;22245&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;54515&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;54515&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need two different levels of data from these scores:1, the frequencies of each (for cat1 and cat2), 1-5, which I easily get with Proc Freq, and 2) a calculated summary scores using the following equation and a variation (one for each of cat1 and cat2): (&lt;STRONG style="mso-bidi-language: AR-SA; mso-fareast-language: EN-US; mso-bidi-font-family: 'Times New Roman'; color: black; font-size: 11pt; mso-ansi-language: EN-US; font-family: 'Georgia','serif'; mso-fareast-font-family: 'Times New Roman';"&gt;3+4)/(1+2+3+4) &lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE cellpadding="5" cellspacing="0" class="table" frame="box" rules="all" summary="Procedure Freq: One-Way Frequencies"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;&lt;TD class="r data"&gt;14&lt;/TD&gt;&lt;TD class="r data"&gt;0.33&lt;/TD&gt;&lt;TD class="r data"&gt;14&lt;/TD&gt;&lt;TD class="r data"&gt;0.33&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;&lt;TD class="r data"&gt;1057&lt;/TD&gt;&lt;TD class="r data"&gt;25.08&lt;/TD&gt;&lt;TD class="r data"&gt;1071&lt;/TD&gt;&lt;TD class="r data"&gt;25.42&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;&lt;TD class="r data"&gt;511&lt;/TD&gt;&lt;TD class="r data"&gt;12.13&lt;/TD&gt;&lt;TD class="r data"&gt;1582&lt;/TD&gt;&lt;TD class="r data"&gt;37.54&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;4&lt;/TH&gt;&lt;TD class="r data"&gt;859&lt;/TD&gt;&lt;TD class="r data"&gt;20.38&lt;/TD&gt;&lt;TD class="r data"&gt;2441&lt;/TD&gt;&lt;TD class="r data"&gt;57.93&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;5&lt;/TH&gt;&lt;TD class="r data"&gt;1773&lt;/TD&gt;&lt;TD class="r data"&gt;42.07&lt;/TD&gt;&lt;TD class="r data"&gt;4214&lt;/TD&gt;&lt;TD class="r data"&gt;100.00&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I export my Proc Freq then I have a nice dataset that looks like the above table, but I don't know how to get this into another dataset or table that calculates my final score.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thoughts?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2014 22:00:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-complex-ish-calculations-with-variable-frequencies/m-p/168553#M264035</guid>
      <dc:creator>lynnem</dc:creator>
      <dc:date>2014-05-21T22:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to do complex(ish) calculations with variable frequencies/percentages?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-complex-ish-calculations-with-variable-frequencies/m-p/168554#M264036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where is the 1+2+3+4 coming from?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2014 22:35:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-complex-ish-calculations-with-variable-frequencies/m-p/168554#M264036</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-05-21T22:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to do complex(ish) calculations with variable frequencies/percentages?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-complex-ish-calculations-with-variable-frequencies/m-p/168555#M264037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Those are the observation numbers. The calculation will look like this, filling in the frequencies for the observation numbers:&lt;/P&gt;&lt;P&gt;(511+859)/(14+1057+511+859) = 1370/2441 = 0.5612&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to automate that calculation so that I can export it and any other calculations into another dataset?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2014 13:50:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-complex-ish-calculations-with-variable-frequencies/m-p/168555#M264037</guid>
      <dc:creator>lynnem</dc:creator>
      <dc:date>2014-05-22T13:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to do complex(ish) calculations with variable frequencies/percentages?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-complex-ish-calculations-with-variable-frequencies/m-p/168556#M264038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't be 100% sure because you have two sets of sample data that don't match up and that's confusing me. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you may want to look into the multi label format and proc tabulate which will calculate these for you automatically. &lt;/P&gt;&lt;P&gt;This is under the assumption you want a standard proc freq, but then some pre defined categories as well, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, your data has values 1, 2, 3,4 and you want to count how many 1, 2, 3, 4 and 3/4 together. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2014 14:11:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-complex-ish-calculations-with-variable-frequencies/m-p/168556#M264038</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-05-22T14:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to do complex(ish) calculations with variable frequencies/percentages?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-complex-ish-calculations-with-variable-frequencies/m-p/168557#M264039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data have;
input a b c d e;
cards;
1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;14&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.33&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;14&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.33
2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1057&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;25.08&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1071&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;25.42
3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;511&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;12.13&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1582&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;37.54
4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;859&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;20.38&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2441&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;57.93
5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1773&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;42.07&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;4214&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;100.00
;
run;
data var(keep=var1 var2);
 set have ;
 array x{4} _temporary_;
 array y{4} _temporary_;
 x{_n_}=b; y{_n_}=d;
 if _n_ eq 4 then do;
&amp;nbsp;&amp;nbsp; var1=(x{3}+x{4})/sum(of x{*}) ;
&amp;nbsp;&amp;nbsp; var2=(y{3}+y{4})/sum(of y{*}) ;
&amp;nbsp; output; stop;
 end;
run;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2014 14:23:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-complex-ish-calculations-with-variable-frequencies/m-p/168557#M264039</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-05-22T14:23:35Z</dc:date>
    </item>
  </channel>
</rss>

