<?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 Outputting proportions into new variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Outputting-proportions-into-new-variables/m-p/472824#M71010</link>
    <description>&lt;P&gt;I'm trying to create a new variable for my dataset that&amp;nbsp;uses proportions from other variables.&lt;/P&gt;&lt;P&gt;I created a variable for the&amp;nbsp;mean level of compliance in each room (room_complianceMEAN)&amp;nbsp;in a separate dataset but cannot merge the sets back onto the main set and room_name. I'm using SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;I’m trying to:&lt;/P&gt;&lt;P class="p1"&gt;1. total the number of observations where a certain dispenser is used for a room&lt;/P&gt;&lt;P class="p1"&gt;&lt;EM&gt;where dispensing_sensor_name = “sensor name” and room_name =“room name”;&lt;/EM&gt;&lt;/P&gt;&lt;P class="p1"&gt;2. create a variable that acts as the proportion of uses in that room to the total number of use in that room&lt;/P&gt;&lt;P class="p1"&gt;3. add these variables to the dataset so they can be used along with others in a model&lt;/P&gt;&lt;P class="p1"&gt;&lt;EM&gt;use_proportion, room_rank, worker_type, floor, intervention, etc.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC MEANS data = hh7;&lt;BR /&gt;VAR compliant;&lt;BR /&gt;CLASS room_name;&lt;BR /&gt;OUTPUT OUT=room_complianceMEAN MEAN= /AUTONAME;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data = room_complianceMEAN;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;PROC freq data = hh7;&lt;BR /&gt;where compliant =1;&lt;BR /&gt;tables dispensing_sensor_name;&lt;BR /&gt;by room_name;&lt;BR /&gt;OUTPUT OUT=room_USEPROPORTION;&lt;BR /&gt;run;&lt;BR /&gt;proc print data =room_USEPROPORTION;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc freq data = hh7;&lt;BR /&gt;where room_name="Room 7108-9";&lt;BR /&gt;tables dispensing_sensor_name*compliant /missing;&lt;BR /&gt;OUTPUT OUT=room_USEPROPORTION;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Sun, 24 Jun 2018 20:42:19 GMT</pubDate>
    <dc:creator>Peka</dc:creator>
    <dc:date>2018-06-24T20:42:19Z</dc:date>
    <item>
      <title>Outputting proportions into new variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Outputting-proportions-into-new-variables/m-p/472824#M71010</link>
      <description>&lt;P&gt;I'm trying to create a new variable for my dataset that&amp;nbsp;uses proportions from other variables.&lt;/P&gt;&lt;P&gt;I created a variable for the&amp;nbsp;mean level of compliance in each room (room_complianceMEAN)&amp;nbsp;in a separate dataset but cannot merge the sets back onto the main set and room_name. I'm using SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;I’m trying to:&lt;/P&gt;&lt;P class="p1"&gt;1. total the number of observations where a certain dispenser is used for a room&lt;/P&gt;&lt;P class="p1"&gt;&lt;EM&gt;where dispensing_sensor_name = “sensor name” and room_name =“room name”;&lt;/EM&gt;&lt;/P&gt;&lt;P class="p1"&gt;2. create a variable that acts as the proportion of uses in that room to the total number of use in that room&lt;/P&gt;&lt;P class="p1"&gt;3. add these variables to the dataset so they can be used along with others in a model&lt;/P&gt;&lt;P class="p1"&gt;&lt;EM&gt;use_proportion, room_rank, worker_type, floor, intervention, etc.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC MEANS data = hh7;&lt;BR /&gt;VAR compliant;&lt;BR /&gt;CLASS room_name;&lt;BR /&gt;OUTPUT OUT=room_complianceMEAN MEAN= /AUTONAME;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data = room_complianceMEAN;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;PROC freq data = hh7;&lt;BR /&gt;where compliant =1;&lt;BR /&gt;tables dispensing_sensor_name;&lt;BR /&gt;by room_name;&lt;BR /&gt;OUTPUT OUT=room_USEPROPORTION;&lt;BR /&gt;run;&lt;BR /&gt;proc print data =room_USEPROPORTION;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc freq data = hh7;&lt;BR /&gt;where room_name="Room 7108-9";&lt;BR /&gt;tables dispensing_sensor_name*compliant /missing;&lt;BR /&gt;OUTPUT OUT=room_USEPROPORTION;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jun 2018 20:42:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Outputting-proportions-into-new-variables/m-p/472824#M71010</guid>
      <dc:creator>Peka</dc:creator>
      <dc:date>2018-06-24T20:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Outputting proportions into new variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Outputting-proportions-into-new-variables/m-p/472825#M71011</link>
      <description>&lt;P&gt;Since you didn't explain, let me ask why do you say "cannot merge the sets back onto the main set and room_name"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Explain!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show us your SASLOG.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show us a portion of your data, following these instructions:&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>Sun, 24 Jun 2018 21:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Outputting-proportions-into-new-variables/m-p/472825#M71011</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-06-24T21:21:27Z</dc:date>
    </item>
  </channel>
</rss>

