<?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: something similar to PROC FREQ??? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/something-similar-to-PROC-FREQ/m-p/65040#M18518</link>
    <description>There is no standard way of doing this that I aware of.&lt;BR /&gt;
You'll probably en up with using the data step together with RETAIN.&lt;BR /&gt;
One way is to build up a string (ABA, ABAB etc) for each patient, and then doing a PROC FREQ on the result.&lt;BR /&gt;
/Linus</description>
    <pubDate>Mon, 17 Aug 2009 12:14:12 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2009-08-17T12:14:12Z</dc:date>
    <item>
      <title>something similar to PROC FREQ???</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/something-similar-to-PROC-FREQ/m-p/65039#M18517</link>
      <description>I want to do something similar to proc freq, I have the following data set that shows the type of treatment the patient was prescribed and the date of prescription. I managed to sort by prescription:&lt;BR /&gt;
&lt;BR /&gt;
subject treatment prescribed_date&lt;BR /&gt;
1   A   08/08/1997 &lt;BR /&gt;
1   B   07/09/2000&lt;BR /&gt;
1   A   05/06/2002&lt;BR /&gt;
2   A   08/03/1996 &lt;BR /&gt;
2   B   12/01/1999&lt;BR /&gt;
2   A   05/06/2002&lt;BR /&gt;
2   B   09/11/2003&lt;BR /&gt;
3   B   02/05/1992&lt;BR /&gt;
4   B   02/08/1998&lt;BR /&gt;
5   A   05 /09/1999&lt;BR /&gt;
6   A  06 /06/2000&lt;BR /&gt;
7   A   08/08/1997 &lt;BR /&gt;
7   B   07/09/2000&lt;BR /&gt;
7   A   05/06/2002&lt;BR /&gt;
&lt;BR /&gt;
Is it possible to request SAS to perform the following: Tell me how many patients the received the treatments in the order ABA, ABAB, etc.&lt;BR /&gt;
&lt;BR /&gt;
That is I will like  SAS to tell me or produce a table showing me that there are 2 patients who received the treatments in the order ABA, 1 patient in the order ABAB,  2 patients in the order B only.  2 patients in order A&lt;BR /&gt;
&lt;BR /&gt;
Please help</description>
      <pubDate>Mon, 17 Aug 2009 11:01:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/something-similar-to-PROC-FREQ/m-p/65039#M18517</guid>
      <dc:creator>Statsconsultancy</dc:creator>
      <dc:date>2009-08-17T11:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: something similar to PROC FREQ???</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/something-similar-to-PROC-FREQ/m-p/65040#M18518</link>
      <description>There is no standard way of doing this that I aware of.&lt;BR /&gt;
You'll probably en up with using the data step together with RETAIN.&lt;BR /&gt;
One way is to build up a string (ABA, ABAB etc) for each patient, and then doing a PROC FREQ on the result.&lt;BR /&gt;
/Linus</description>
      <pubDate>Mon, 17 Aug 2009 12:14:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/something-similar-to-PROC-FREQ/m-p/65040#M18518</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2009-08-17T12:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: something similar to PROC FREQ???</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/something-similar-to-PROC-FREQ/m-p/65041#M18519</link>
      <description>[pre]data input;&lt;BR /&gt;
input subject treatment $ prescribed_date ddmmyy10.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1 A 08/08/1997 &lt;BR /&gt;
1 B 07/09/2000&lt;BR /&gt;
1 A 05/06/2002&lt;BR /&gt;
2 A 08/03/1996 &lt;BR /&gt;
2 B 12/01/1999&lt;BR /&gt;
2 A 05/06/2002&lt;BR /&gt;
2 B 09/11/2003&lt;BR /&gt;
3 B 02/05/1992&lt;BR /&gt;
4 B 02/08/1998&lt;BR /&gt;
5 A 05/09/1999&lt;BR /&gt;
6 A 06/06/2000&lt;BR /&gt;
7 A 08/08/1997 &lt;BR /&gt;
7 B 07/09/2000&lt;BR /&gt;
7 A 05/06/2002&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
 &lt;BR /&gt;
proc sort data=input;&lt;BR /&gt;
  by subject prescribed_date treatment;&lt;BR /&gt;
run;&lt;BR /&gt;
 &lt;BR /&gt;
proc transpose data=input &lt;BR /&gt;
                out=trans;&lt;BR /&gt;
  by subject;&lt;BR /&gt;
  var treatment;&lt;BR /&gt;
run;&lt;BR /&gt;
 &lt;BR /&gt;
data treatments;&lt;BR /&gt;
  set trans;&lt;BR /&gt;
  treatments=cats(of col:); &lt;BR /&gt;
run;&lt;BR /&gt;
 &lt;BR /&gt;
proc freq data=treatments;&lt;BR /&gt;
  tables treatments /list;&lt;BR /&gt;
run;</description>
      <pubDate>Mon, 17 Aug 2009 13:40:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/something-similar-to-PROC-FREQ/m-p/65041#M18519</guid>
      <dc:creator>GertNissen</dc:creator>
      <dc:date>2009-08-17T13:40:35Z</dc:date>
    </item>
  </channel>
</rss>

