<?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: How to randomly and equally distribute patients into multiple graphs in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-and-equally-distribute-patients-into-multiple/m-p/922501#M363245</link>
    <description>&lt;P&gt;Some questions that you have to answer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do we know how many "patients" are intended for any one graph (before splitting)? Do&amp;nbsp; you have a variable that indicates that? Or is this really "I have X number of observations in general and need to split them for graphing based on the number X?"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The content and structure of your data set may be quite important if this involves pre-indentified "graphs" that certain groups of patients may be currently assigned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When it comes to random selection then the procedure is almost certain to be Proc SurveySelect. But as I say, the content of your current data and how it is to be set up for selection is important.&lt;/P&gt;
&lt;P&gt;A basic when you know the number of groups that you want is to use the GROUPS=option.&lt;/P&gt;
&lt;P&gt;This is a brief example that you can run using a data set that should be included in your installation:&lt;/P&gt;
&lt;PRE&gt;Proc surveyselect data=sashelp.class out=work.grouped groups=3;
run;&lt;/PRE&gt;
&lt;P&gt;You can look at the output data set, Work.Grouped, and see that a variable Groupid has been added. It will have nearly equal numbers of observations assigned to each group.&lt;/P&gt;
&lt;P&gt;When graphing this data you would sort the data by the GroupID variable and use a BY GroupId in Proc Sgplot (or which ever procedure you intend) to create separate plots for each group. Or use the GroupId as a Panelby variable in Proc Sgpanel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Apr 2024 21:28:44 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-04-01T21:28:44Z</dc:date>
    <item>
      <title>How to randomly and equally distribute patients into multiple graphs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-and-equally-distribute-patients-into-multiple/m-p/922497#M363243</link>
      <description>&lt;P&gt;Hi everyone. I'm working on some figures for my client and this is part of the instructions in the spec:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"If there are ≥150 patients with data for a given figure, please randomly and equally distribute patients into multiple graphs so that there are &amp;lt;150 patients in each graph. For example, if there are 160 patients, create 2 graphs with 80 patients each. If there are 300 patients with data, create 3 graphs with 100 patients each."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not even sure where to start with this. Any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 20:51:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-and-equally-distribute-patients-into-multiple/m-p/922497#M363243</guid>
      <dc:creator>swillhoite</dc:creator>
      <dc:date>2024-04-01T20:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to randomly and equally distribute patients into multiple graphs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-and-equally-distribute-patients-into-multiple/m-p/922501#M363245</link>
      <description>&lt;P&gt;Some questions that you have to answer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do we know how many "patients" are intended for any one graph (before splitting)? Do&amp;nbsp; you have a variable that indicates that? Or is this really "I have X number of observations in general and need to split them for graphing based on the number X?"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The content and structure of your data set may be quite important if this involves pre-indentified "graphs" that certain groups of patients may be currently assigned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When it comes to random selection then the procedure is almost certain to be Proc SurveySelect. But as I say, the content of your current data and how it is to be set up for selection is important.&lt;/P&gt;
&lt;P&gt;A basic when you know the number of groups that you want is to use the GROUPS=option.&lt;/P&gt;
&lt;P&gt;This is a brief example that you can run using a data set that should be included in your installation:&lt;/P&gt;
&lt;PRE&gt;Proc surveyselect data=sashelp.class out=work.grouped groups=3;
run;&lt;/PRE&gt;
&lt;P&gt;You can look at the output data set, Work.Grouped, and see that a variable Groupid has been added. It will have nearly equal numbers of observations assigned to each group.&lt;/P&gt;
&lt;P&gt;When graphing this data you would sort the data by the GroupID variable and use a BY GroupId in Proc Sgplot (or which ever procedure you intend) to create separate plots for each group. Or use the GroupId as a Panelby variable in Proc Sgpanel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 21:28:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-and-equally-distribute-patients-into-multiple/m-p/922501#M363245</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-01T21:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to randomly and equally distribute patients into multiple graphs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-and-equally-distribute-patients-into-multiple/m-p/922507#M363246</link>
      <description>&lt;P&gt;What happens if N cannot be split into exactly equal groups? If N is a prime number (and sometimes even if it is not prime), you cannot get equal numbers in each group. N=173 (a prime number) can be split into groups of 86 and 87, or 90 and 83, or ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What to do then?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What if N=400, is that 4 groups of 100, or 5 groups of 80, or 3 groups of 133, 133 and 134?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;also raises some good points, and all of these are things you need to think about -- and discuss with your client to get his/her agreement, long before you start writing SAS code.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 23:53:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-and-equally-distribute-patients-into-multiple/m-p/922507#M363246</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-04-01T23:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to randomly and equally distribute patients into multiple graphs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-and-equally-distribute-patients-into-multiple/m-p/922633#M363302</link>
      <description>Thank you. We came up with the following solution:&lt;BR /&gt;Start with this:&lt;BR /&gt;Total N (per param) = TOTN&lt;BR /&gt;Number of groups needed (ceiling of TOTN/150)= TOTGRP&lt;BR /&gt;&lt;BR /&gt;Then use proc surveyselect to randomly assign subjects to group:&lt;BR /&gt;&lt;BR /&gt;proc surveyselect data=temp(where=(paramn eq 1 and ablfn eq 1)) out=grp1(keep=paramn usubjid groupid) groups=&amp;amp;totgrp1 seed=12345 noprint;&lt;BR /&gt;run;&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Apr 2024 20:59:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-and-equally-distribute-patients-into-multiple/m-p/922633#M363302</guid>
      <dc:creator>swillhoite</dc:creator>
      <dc:date>2024-04-02T20:59:15Z</dc:date>
    </item>
  </channel>
</rss>

