<?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 Excluding patients for a subgroup analysis in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Excluding-patients-for-a-subgroup-analysis/m-p/767941#M243522</link>
    <description>&lt;P&gt;I am trying to figure out the best way to program this.&lt;/P&gt;&lt;P&gt;I have 1000 cases that are identified by a ID number.&lt;/P&gt;&lt;P&gt;I have 4000 controls (matched case:control by 1:4) that have their own unique ID number. Each control has another variable called case_ID and this is where the ID number of the respective case is included. For each case, the case_ID is denoted as "." (missing)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to perform a subgroup analysis where I only look at a group of cases (those defined as CAA="No Involvement") and their respective controls. I have removed the irrelevant cases from my dataset with the following:&lt;/P&gt;&lt;PRE&gt;keepit = .;
if case=0 then keepit=1;
if case=1 and CAA="No Involvement" then keepit=1;
where keepit=1;&lt;/PRE&gt;&lt;P&gt;Is there a way to program such that I only keep the controls where their respective case_ID is a case that exists in the dataset?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 15 Sep 2021 17:18:13 GMT</pubDate>
    <dc:creator>jennxxness</dc:creator>
    <dc:date>2021-09-15T17:18:13Z</dc:date>
    <item>
      <title>Excluding patients for a subgroup analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excluding-patients-for-a-subgroup-analysis/m-p/767941#M243522</link>
      <description>&lt;P&gt;I am trying to figure out the best way to program this.&lt;/P&gt;&lt;P&gt;I have 1000 cases that are identified by a ID number.&lt;/P&gt;&lt;P&gt;I have 4000 controls (matched case:control by 1:4) that have their own unique ID number. Each control has another variable called case_ID and this is where the ID number of the respective case is included. For each case, the case_ID is denoted as "." (missing)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to perform a subgroup analysis where I only look at a group of cases (those defined as CAA="No Involvement") and their respective controls. I have removed the irrelevant cases from my dataset with the following:&lt;/P&gt;&lt;PRE&gt;keepit = .;
if case=0 then keepit=1;
if case=1 and CAA="No Involvement" then keepit=1;
where keepit=1;&lt;/PRE&gt;&lt;P&gt;Is there a way to program such that I only keep the controls where their respective case_ID is a case that exists in the dataset?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 17:18:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excluding-patients-for-a-subgroup-analysis/m-p/767941#M243522</guid>
      <dc:creator>jennxxness</dc:creator>
      <dc:date>2021-09-15T17:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding patients for a subgroup analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excluding-patients-for-a-subgroup-analysis/m-p/767952#M243526</link>
      <description>&lt;P&gt;I don't understand your problem enough to make a substantive comment about solving the problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do understand your SAS code, and the WHERE statement does not work there. WHERE can only work on variables that are present when the data step begins, which is usually the variables in the data set(s) named in a SET or MERGE statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In place of the WHERE statement, you can use a subsetting IF statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if keepit=1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 18:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excluding-patients-for-a-subgroup-analysis/m-p/767952#M243526</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-09-15T18:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding patients for a subgroup analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excluding-patients-for-a-subgroup-analysis/m-p/768006#M243553</link>
      <description>&lt;P&gt;While posting a sample of the data might help clarify the question, it sounds like you need just one statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if (case=0) or (case=1 and CAA="No Involvement";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;At least that would be equivalent to the four statements you are using now.&amp;nbsp; If there is a need to find matches vs. nonmatches, there may be more to it. but your post doesn't show enough of the situation to comment further.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 21:00:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excluding-patients-for-a-subgroup-analysis/m-p/768006#M243553</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-09-15T21:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding patients for a subgroup analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excluding-patients-for-a-subgroup-analysis/m-p/768339#M243708</link>
      <description>&lt;P&gt;From your description, it sounds like you might have 1,000 cases and 4,000 controls as rows in one dataset that has 5,000 rows.&amp;nbsp; Is that right?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you show a sample of of your input data (just ~10 records, with ID, Case, Case_ID, CAA) and the desired output from that sample?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I'm understanding what you want, I would do it in three steps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Select the cases of interest (those with CAA="No Involvement") and output them to a dataset.&lt;/P&gt;
&lt;P&gt;2. Select the controls for those cases (you could do this by joining/merging the cases of interest to the original data, matching the ID for the cases to the Case_ID of the controls.&lt;/P&gt;
&lt;P&gt;3. Stack together the selected cases and controls.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It could probably be done with one step, but for such small data, I'd probably do it in multiple steps.&amp;nbsp; So if there are 111 cases with&amp;nbsp;CAA="No Involvement" the first step would output 111 records.&amp;nbsp; The second step would output 444 records. And stacking them together would give 555 records.&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;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Sep 2021 17:47:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excluding-patients-for-a-subgroup-analysis/m-p/768339#M243708</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2021-09-17T17:47:24Z</dc:date>
    </item>
  </channel>
</rss>

