<?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 How do I run frequencies with multiple observations per subject? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-run-frequencies-with-multiple-observations-per-subject/m-p/647559#M22163</link>
    <description>&lt;P&gt;I have a dataset with 70 variables and thousands of subjects. About half of the subjects have multiple observations (anywhere from 2 to 13). I've created an "id" variable to figure out how many subjects I have and how many observations per subject there are. How do I find the correct frequency of participants by variable if proc freq only counts the frequency of observations?&lt;/P&gt;</description>
    <pubDate>Wed, 13 May 2020 17:55:23 GMT</pubDate>
    <dc:creator>cme2146</dc:creator>
    <dc:date>2020-05-13T17:55:23Z</dc:date>
    <item>
      <title>How do I run frequencies with multiple observations per subject?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-run-frequencies-with-multiple-observations-per-subject/m-p/647559#M22163</link>
      <description>&lt;P&gt;I have a dataset with 70 variables and thousands of subjects. About half of the subjects have multiple observations (anywhere from 2 to 13). I've created an "id" variable to figure out how many subjects I have and how many observations per subject there are. How do I find the correct frequency of participants by variable if proc freq only counts the frequency of observations?&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 17:55:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-run-frequencies-with-multiple-observations-per-subject/m-p/647559#M22163</guid>
      <dc:creator>cme2146</dc:creator>
      <dc:date>2020-05-13T17:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I run frequencies with multiple observations per subject?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-run-frequencies-with-multiple-observations-per-subject/m-p/647561#M22164</link>
      <description>&lt;P&gt;Please explain further what you want. This part isn't clear to me: "&lt;SPAN&gt;&amp;nbsp;How do I find the correct frequency of participants by variable if proc freq only counts the frequency of observations?"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also, please show a brief example.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 18:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-run-frequencies-with-multiple-observations-per-subject/m-p/647561#M22164</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-05-13T18:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I run frequencies with multiple observations per subject?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-run-frequencies-with-multiple-observations-per-subject/m-p/647564#M22166</link>
      <description>&lt;P&gt;Hint: provide an example of values similar to what you have. The sample should be small enough you can calculate the "frequency" you want by hand. Then show what the frequency should look like for the example data.&lt;/P&gt;
&lt;P&gt;Make sure to include different types of cases.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But Participants by variable means you will have to show examples of that as well. And if any one subject has multiple different values for a given variable your example should include that as well with the desired result.&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 18:07:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-run-frequencies-with-multiple-observations-per-subject/m-p/647564#M22166</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-13T18:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I run frequencies with multiple observations per subject?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-run-frequencies-with-multiple-observations-per-subject/m-p/647609#M22170</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/259979"&gt;@cme2146&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC SQL with its &lt;FONT face="courier new,courier"&gt;&lt;A href="https://documentation.sas.com/?docsetId=sqlproc&amp;amp;docsetTarget=n123fsko39j44pn16zlt087e1m2h.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;count(distinct ...)&lt;/A&gt;&lt;/FONT&gt; syntax is a useful complement to PROC FREQ in the situation you've described. See two examples below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create test data for demonstration */

data have;
input id var1 var2 $;
cards;
1  90 B
1 105 B
1 108 A
2  85 B
3  95 C
3 101 C
3 100 A
3  97 A
4 110 C
4 104 B
4 104 A
5  75 C
5  80 C
5  80 B
5  70 B
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select count(distinct id) label='Number of participants with VAR1&amp;gt;=100'
from have
where var1&amp;gt;=100;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;PRE&gt;   Number of
participants
        with
   VAR1&amp;gt;=100
------------
           3&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select var2, count(distinct id) label='Number of participants'
from have
group by var2;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;PRE&gt;             Number of
var2      participants
----------------------
A                    3
B                    4
C                    3&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 20:23:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-run-frequencies-with-multiple-observations-per-subject/m-p/647609#M22170</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-05-13T20:23:56Z</dc:date>
    </item>
  </channel>
</rss>

