<?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 Multiplying a variable with its corresponding frequency in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Multiplying-a-variable-with-its-corresponding-frequency/m-p/477546#M71306</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a sas beginner and I wanted to do the following. I have a variable "int" that has integers and when I run proc freq on it I get how many observations are associated with each variable. For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;int&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Frequency&lt;/P&gt;&lt;P&gt;0.17&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1123&lt;/P&gt;&lt;P&gt;0.92&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;156&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2300&lt;/P&gt;&lt;P&gt;1.42&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2152&lt;/P&gt;&lt;P&gt;1.67&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 635&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a new variable that multiplies int*frequency. I then want a total sum of this new variable. Any help would be appreciated, thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jul 2018 15:26:04 GMT</pubDate>
    <dc:creator>Ethid</dc:creator>
    <dc:date>2018-07-12T15:26:04Z</dc:date>
    <item>
      <title>Multiplying a variable with its corresponding frequency</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multiplying-a-variable-with-its-corresponding-frequency/m-p/477546#M71306</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a sas beginner and I wanted to do the following. I have a variable "int" that has integers and when I run proc freq on it I get how many observations are associated with each variable. For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;int&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Frequency&lt;/P&gt;&lt;P&gt;0.17&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1123&lt;/P&gt;&lt;P&gt;0.92&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;156&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2300&lt;/P&gt;&lt;P&gt;1.42&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2152&lt;/P&gt;&lt;P&gt;1.67&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 635&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a new variable that multiplies int*frequency. I then want a total sum of this new variable. Any help would be appreciated, thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 15:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multiplying-a-variable-with-its-corresponding-frequency/m-p/477546#M71306</guid>
      <dc:creator>Ethid</dc:creator>
      <dc:date>2018-07-12T15:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Multiplying a variable with its corresponding frequency</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multiplying-a-variable-with-its-corresponding-frequency/m-p/477548#M71308</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input int              Frequency;
cards;
0.17           1123
0.92           156
1                 2300
1.42            2152
1.67            635
;

proc sql;
create table want as
select *,int*frequency as multi, sum(calculated multi) as sum
from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Jul 2018 15:29:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multiplying-a-variable-with-its-corresponding-frequency/m-p/477548#M71308</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-07-12T15:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Multiplying a variable with its corresponding frequency</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multiplying-a-variable-with-its-corresponding-frequency/m-p/477557#M71310</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have;
&amp;nbsp; &amp;nbsp; var&amp;nbsp;int;
    weight frequency;
    output out=want sum=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Jul 2018 15:33:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multiplying-a-variable-with-its-corresponding-frequency/m-p/477557#M71310</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-12T15:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: Multiplying a variable with its corresponding frequency</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multiplying-a-variable-with-its-corresponding-frequency/m-p/477560#M71312</link>
      <description>&lt;P&gt;If you step away from PROC FREQ for a moment, you can get this from your original data set directly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc summary data=original nway;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; class int;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; var int;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; output out=want (keep=int total) sum=total;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 15:36:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multiplying-a-variable-with-its-corresponding-frequency/m-p/477560#M71312</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-07-12T15:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: Multiplying a variable with its corresponding frequency</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multiplying-a-variable-with-its-corresponding-frequency/m-p/477564#M71314</link>
      <description>&lt;P&gt;Hi all, thank you for the help! It seems you are suggesting I make a new data set where I manually enter the "int" and "frequency" values. I have hundred of&amp;nbsp; "int" values however so it would take me a while to run proc freq on int then create a dataset using the frequency proc freq generated for me. is there another way to do it that doesn't involve me manually creating a new dataset?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 15:38:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multiplying-a-variable-with-its-corresponding-frequency/m-p/477564#M71314</guid>
      <dc:creator>Ethid</dc:creator>
      <dc:date>2018-07-12T15:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Multiplying a variable with its corresponding frequency</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multiplying-a-variable-with-its-corresponding-frequency/m-p/477567#M71316</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/220109"&gt;@Ethid&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all, thank you for the help! It seems you are suggesting I make a new data set where I manually enter the "int" and "frequency" values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is entirely a different issue. Nowhere did I suggest you make a new data set. You can do this with your existing SAS data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;I have hundred of&amp;nbsp; "int" values however so it would take me a while to run proc freq on int then create a dataset using the frequency proc freq generated for me.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This is not correct, PROC FREQ ought to run quickly. It won't multiply the values as you requested.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;is there another way to do it that doesn't involve me manually creating a new dataset?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You don't have to make a new dataset.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 15:42:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multiplying-a-variable-with-its-corresponding-frequency/m-p/477567#M71316</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-12T15:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: Multiplying a variable with its corresponding frequency</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multiplying-a-variable-with-its-corresponding-frequency/m-p/477568#M71317</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can add this to the end of your Freq table statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tables int / out=xx;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data new_result;&lt;/P&gt;&lt;P&gt;set xx;&lt;/P&gt;&lt;P&gt;new_data=int*count;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 15:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multiplying-a-variable-with-its-corresponding-frequency/m-p/477568#M71317</guid>
      <dc:creator>EEng</dc:creator>
      <dc:date>2018-07-12T15:43:30Z</dc:date>
    </item>
  </channel>
</rss>

