<?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: incoporating results of a freq table into a new  variable in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/incoporating-results-of-a-freq-table-into-a-new-variable/m-p/504065#M915</link>
    <description>&lt;P&gt;It's not 100% clear what you are seeking, but this might be it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data=have;&lt;/P&gt;
&lt;P&gt;tables hospital / noprint out=counts (keep=hospital count);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=have;&lt;/P&gt;
&lt;P&gt;by hospital;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;merge have counts;&lt;/P&gt;
&lt;P&gt;by hospital;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Sun, 14 Oct 2018 00:29:26 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-10-14T00:29:26Z</dc:date>
    <item>
      <title>incoporating results of a freq table into a new  variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/incoporating-results-of-a-freq-table-into-a-new-variable/m-p/504033#M907</link>
      <description>&lt;P&gt;I am using a large database of patients. Each has a hospital assigned (there are several hundred hospitals and 100,000+ patients). I created a frequency table to determine how many times each hospital performed the procedure during the years of the study (each patient only has 1 procedure and it is during a given year).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create a new variable where for a given patient row,&amp;nbsp;they have a count of number of procedures performed at their treatment hospital that year (basically taking that data from the frequency table for their specific hospital).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any assistance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Oct 2018 18:10:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/incoporating-results-of-a-freq-table-into-a-new-variable/m-p/504033#M907</guid>
      <dc:creator>tbn1</dc:creator>
      <dc:date>2018-10-13T18:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: incoporating results of a freq table into a new  variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/incoporating-results-of-a-freq-table-into-a-new-variable/m-p/504040#M910</link>
      <description>&lt;P&gt;Without further details, I can illustrate how to pipe your results from PROC FREQ into a data set, but if you need more specific help you'll need to provide significantly more details and sample&amp;nbsp;data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=sashelp.class noprint;

table age * sex / out = want;

run;


proc print data = want label noobs;
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/221997"&gt;@tbn1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am using a large database of patients. Each has a hospital assigned (there are several hundred hospitals and 100,000+ patients). I created a frequency table to determine how many times each hospital performed the procedure during the years of the study (each patient only has 1 procedure and it is during a given year).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to create a new variable where for a given patient row,&amp;nbsp;they have a count of number of procedures performed at their treatment hospital that year (basically taking that data from the frequency table for their specific hospital).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I appreciate any assistance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&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>Sat, 13 Oct 2018 20:16:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/incoporating-results-of-a-freq-table-into-a-new-variable/m-p/504040#M910</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-13T20:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: incoporating results of a freq table into a new  variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/incoporating-results-of-a-freq-table-into-a-new-variable/m-p/504065#M915</link>
      <description>&lt;P&gt;It's not 100% clear what you are seeking, but this might be it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data=have;&lt;/P&gt;
&lt;P&gt;tables hospital / noprint out=counts (keep=hospital count);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=have;&lt;/P&gt;
&lt;P&gt;by hospital;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;merge have counts;&lt;/P&gt;
&lt;P&gt;by hospital;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Oct 2018 00:29:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/incoporating-results-of-a-freq-table-into-a-new-variable/m-p/504065#M915</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-10-14T00:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: incoporating results of a freq table into a new  variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/incoporating-results-of-a-freq-table-into-a-new-variable/m-p/504482#M982</link>
      <description>This is exactly what I want! But I would like to stratify it by one more layer - counts of hospital by year. Can you help me do that?&lt;BR /&gt;Thanks so much!!&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Oct 2018 20:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/incoporating-results-of-a-freq-table-into-a-new-variable/m-p/504482#M982</guid>
      <dc:creator>tbn1</dc:creator>
      <dc:date>2018-10-15T20:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: incoporating results of a freq table into a new  variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/incoporating-results-of-a-freq-table-into-a-new-variable/m-p/504496#M984</link>
      <description>&lt;P&gt;Actually - so I was able to get counts of hospital*year. However, when I try to merge that back into the main sheet, I lose a lot of my overall sample.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to import it back into the sheet such that for patient #3 who had surgery at hospital A in 2014, the count is 5 and that the count is 5 for the other 4 patients that had surgery at hospital A in 2014.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 21:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/incoporating-results-of-a-freq-table-into-a-new-variable/m-p/504496#M984</guid>
      <dc:creator>tbn1</dc:creator>
      <dc:date>2018-10-15T21:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: incoporating results of a freq table into a new  variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/incoporating-results-of-a-freq-table-into-a-new-variable/m-p/504504#M985</link>
      <description>&lt;P&gt;Post the log from the program you ran.&amp;nbsp; It's likely very easy to fix.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 22:00:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/incoporating-results-of-a-freq-table-into-a-new-variable/m-p/504504#M985</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-10-15T22:00:13Z</dc:date>
    </item>
  </channel>
</rss>

