<?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 Randomly selecting 1 case per cluster in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Randomly-selecting-1-case-per-cluster/m-p/448537#M112833</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have data where people (cases) are clustered in groups. I want to randomly select 1 case from each cluster and use only selected cases in the further analysis. (And I want to do this process many times). Is there a simple way to do that? Any suggestions would be very much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P.S. So far I understood how to select the first or last case in a cluster but in my situation I need to select a case randomly.&lt;/P&gt;</description>
    <pubDate>Mon, 26 Mar 2018 00:16:09 GMT</pubDate>
    <dc:creator>Amanda_Lemon</dc:creator>
    <dc:date>2018-03-26T00:16:09Z</dc:date>
    <item>
      <title>Randomly selecting 1 case per cluster</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-selecting-1-case-per-cluster/m-p/448537#M112833</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have data where people (cases) are clustered in groups. I want to randomly select 1 case from each cluster and use only selected cases in the further analysis. (And I want to do this process many times). Is there a simple way to do that? Any suggestions would be very much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P.S. So far I understood how to select the first or last case in a cluster but in my situation I need to select a case randomly.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 00:16:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-selecting-1-case-per-cluster/m-p/448537#M112833</guid>
      <dc:creator>Amanda_Lemon</dc:creator>
      <dc:date>2018-03-26T00:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly selecting 1 case per cluster [how to improve your question]</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-selecting-1-case-per-cluster/m-p/448539#M112834</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/151986"&gt;@Amanda_Lemon&lt;/a&gt;,&lt;/P&gt;&lt;BR /&gt; &lt;P&gt;Your question requires more details before experts can help.&amp;nbsp;Can you revise your question to include more information?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Review this checklist:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Specify a meaningful subject line for your topic.&amp;nbsp; Avoid generic subjects like "need help," "SAS query," or "urgent."&lt;/LI&gt;
&lt;LI&gt;When appropriate, provide sample data in text or DATA step format.&amp;nbsp; See &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;this article for one method&lt;/A&gt;&amp;nbsp;you can use.&lt;/LI&gt;
&lt;LI&gt;If you're encountering an error in SAS, include the SAS log or a screenshot of the error condition.&amp;nbsp;Use the&amp;nbsp;&lt;STRONG&gt;Photos&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;button to include the image in your message.&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" style="width: 279px;"&gt;&lt;IMG src="https://kntur85557.i.lithium.com/t5/image/serverpage/image-id/16608i91A52F817EAC9A69/image-dimensions/279x150?v=1.0" width="279" height="150" alt="use_buttons.png" title="use_buttons.png" /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;It also helps to include an example (table or picture) of the result that you're trying to achieve.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;To edit your original message, select the "blue gear" icon at the top of the message and select&amp;nbsp;&lt;STRONG&gt;Edit Message&lt;/STRONG&gt;.&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;From there you can adjust the title and add more details to the body of the message.&amp;nbsp; Or, simply reply to this message with any additional information you can supply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" style="width: 229px;"&gt;&lt;IMG src="https://kntur85557.i.lithium.com/t5/image/serverpage/image-id/16605iAC020BC79315B045/image-size/large?v=1.0&amp;amp;px=600" alt="edit_post.png" title="edit_post.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;SAS experts are eager to help -- help&amp;nbsp;&lt;EM&gt;them&lt;/EM&gt; by providing as much detail as you can.&lt;/P&gt; &lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-style:italic;font-size:smaller;"&gt;This prewritten response was triggered for you by fellow SAS Support Communities member &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&lt;/SPAN&gt;&lt;/P&gt;.</description>
      <pubDate>Mon, 26 Mar 2018 00:55:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-selecting-1-case-per-cluster/m-p/448539#M112834</guid>
      <dc:creator>Community_Guide</dc:creator>
      <dc:date>2018-03-26T00:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly selecting 1 case per cluster</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-selecting-1-case-per-cluster/m-p/448540#M112835</link>
      <description>&lt;P&gt;Please provide some sample data in Data step and the output your looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can your macros to do repetitive work. You can use&amp;nbsp;CALL SYMPUT on condition to hold the values in macros and call them later. Also check RAND function.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 00:56:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-selecting-1-case-per-cluster/m-p/448540#M112835</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-03-26T00:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly selecting 1 case per cluster</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-selecting-1-case-per-cluster/m-p/448541#M112836</link>
      <description>&lt;P&gt;Thank you for your reply. My data look something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp; Cluster Var1 Var2&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp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nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each case (as indicated by ID) is clustered. For example, Cases 1 and 2 are clustered within Cluster 1; Cases 3, 4, and 5 are clustered within Cluster 2, Case 6 is the only case in Cluster 3; and Cases 7-10 are clustered within Cluster 4. I also have values for each case on Var1 and Var2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to do is to select randomly 1 case per cluster. So, after selection, I will have a data set of 4 cases, each belonging to a unique cluster. After that, I will use this newly formed data set to work with Var1 and Var2, e.g., test for mean differences between Var1 and Var2.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand how to do repetitive work -- I can just have a loop. Also, the RAND statement, I believe, will not help me as I am not generating data -- I already have data from which I just need to randomly select 1 case per cluster.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 01:32:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-selecting-1-case-per-cluster/m-p/448541#M112836</guid>
      <dc:creator>Amanda_Lemon</dc:creator>
      <dc:date>2018-03-26T01:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly selecting 1 case per cluster</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-selecting-1-case-per-cluster/m-p/448544#M112837</link>
      <description>PROC SURVEYSELECT</description>
      <pubDate>Mon, 26 Mar 2018 01:59:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-selecting-1-case-per-cluster/m-p/448544#M112837</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2018-03-26T01:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly selecting 1 case per cluster</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-selecting-1-case-per-cluster/m-p/448545#M112838</link>
      <description>THANK YOU! I knew there got to be an easy way to do that. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 26 Mar 2018 02:15:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-selecting-1-case-per-cluster/m-p/448545#M112838</guid>
      <dc:creator>Amanda_Lemon</dc:creator>
      <dc:date>2018-03-26T02:15:50Z</dc:date>
    </item>
  </channel>
</rss>

