<?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 Subsetting by unique patient IDs and other criteria in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Subsetting-by-unique-patient-IDs-and-other-criteria/m-p/542833#M150026</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am about intermediate level with SAS programming and beginner level with SQL. I am having difficulty subsetting my dataset by certain criteria. The dataset contains patients who have had cancer either once or multiple times. However, if the patients FIRST cancer was not pancreatic, then they need to be deleted. This part I have done. The second step is to get rid of the remaining patients who are in the dataset with any type of cancer, but never had a first cancer listed as pancreatic cancer. One goal of this project is to take a look at patients who had pancreatic cancer as their first cancer, and for those who have had multiple cancers, find out what other types of cancers they got after their pancreatic cancer diagnosis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One way I was trying to do this was by Patient_ID, but I am not aware of any DISTINCT equivalency statements in SAS and I don't know SQL that well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Below is the code I used to get rid of those whose first cancer was not pancreatic. It is also subset by histology type as I do not want patients with certain histological types of pancreatic cancer:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA pancreas_temp1; SET pancreas;
	IF Histologic_Type_ICD_O_3 not in (8150, 8151, 8152, 8153, 8155, 8240, 8241, 8246)
	AND
	Sequence_number IN ("One primary only", "1st of 2 or more primaries") 
	then DELETE;

	IF Primary_Site___labeled not =: 'C25' 
	AND 
	Sequence_number IN ("One primary only", "1st of 2 or more primaries") 
	then DELETE;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here is a sample of my dataset. I have sorted it by Patient_ID which is what revealed the problem - patients with no "Only one primary" or "1st of 2 or more primaries" are in this dataset:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Patient_ID&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Sequence_number&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Primary_site__labeled&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Histologic_Type_ICD_O_3&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;16&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2nd of 2 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C20.9 - Rectum, NOS&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8140&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;18&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2nd of 2 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C38.1-Anterior mediastinum&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8801&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;22&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2nd of 2 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C42.1-Bone marrow&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;9732&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;22&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;3rd of 3 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C50.9-Breast, NOS&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8500&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;25&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;One primary only&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C25.2-Tail of pancreas&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8246&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;31&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;4th of 4 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C50.4-Upper-outer quadrant of breast&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8500&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;31&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;5th of 5 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C34.1-Upper lobe, lung&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8070&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;32&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1st of 2 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C25.0-Head of pancreas&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8155&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I want:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Patient_ID&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Sequence_number&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Primary_site__labeled&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Histologic_Type_ICD_O_3&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;25&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;One primary only&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C25.2-Tail of pancreas&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8246&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;32&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1st of 2 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C25.0-Head of pancreas&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8155&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;32&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2nd of 2 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C64.9-Kidney, NOS&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8312&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Patients 16, 18, 22, and 31 need to go because it is apparent that their first cancer is not listed so we can't tell if it was pancreatic or not.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated. Thank you!&lt;/P&gt;</description>
    <pubDate>Wed, 13 Mar 2019 15:33:33 GMT</pubDate>
    <dc:creator>lady8506</dc:creator>
    <dc:date>2019-03-13T15:33:33Z</dc:date>
    <item>
      <title>Subsetting by unique patient IDs and other criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Subsetting-by-unique-patient-IDs-and-other-criteria/m-p/542833#M150026</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am about intermediate level with SAS programming and beginner level with SQL. I am having difficulty subsetting my dataset by certain criteria. The dataset contains patients who have had cancer either once or multiple times. However, if the patients FIRST cancer was not pancreatic, then they need to be deleted. This part I have done. The second step is to get rid of the remaining patients who are in the dataset with any type of cancer, but never had a first cancer listed as pancreatic cancer. One goal of this project is to take a look at patients who had pancreatic cancer as their first cancer, and for those who have had multiple cancers, find out what other types of cancers they got after their pancreatic cancer diagnosis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One way I was trying to do this was by Patient_ID, but I am not aware of any DISTINCT equivalency statements in SAS and I don't know SQL that well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Below is the code I used to get rid of those whose first cancer was not pancreatic. It is also subset by histology type as I do not want patients with certain histological types of pancreatic cancer:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA pancreas_temp1; SET pancreas;
	IF Histologic_Type_ICD_O_3 not in (8150, 8151, 8152, 8153, 8155, 8240, 8241, 8246)
	AND
	Sequence_number IN ("One primary only", "1st of 2 or more primaries") 
	then DELETE;

	IF Primary_Site___labeled not =: 'C25' 
	AND 
	Sequence_number IN ("One primary only", "1st of 2 or more primaries") 
	then DELETE;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here is a sample of my dataset. I have sorted it by Patient_ID which is what revealed the problem - patients with no "Only one primary" or "1st of 2 or more primaries" are in this dataset:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Patient_ID&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Sequence_number&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Primary_site__labeled&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Histologic_Type_ICD_O_3&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;16&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2nd of 2 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C20.9 - Rectum, NOS&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8140&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;18&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2nd of 2 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C38.1-Anterior mediastinum&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8801&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;22&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2nd of 2 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C42.1-Bone marrow&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;9732&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;22&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;3rd of 3 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C50.9-Breast, NOS&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8500&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;25&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;One primary only&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C25.2-Tail of pancreas&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8246&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;31&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;4th of 4 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C50.4-Upper-outer quadrant of breast&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8500&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;31&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;5th of 5 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C34.1-Upper lobe, lung&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8070&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;32&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1st of 2 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C25.0-Head of pancreas&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8155&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I want:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Patient_ID&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Sequence_number&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Primary_site__labeled&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Histologic_Type_ICD_O_3&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;25&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;One primary only&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C25.2-Tail of pancreas&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8246&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;32&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1st of 2 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C25.0-Head of pancreas&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8155&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;32&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2nd of 2 or more primaries&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;C64.9-Kidney, NOS&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;8312&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Patients 16, 18, 22, and 31 need to go because it is apparent that their first cancer is not listed so we can't tell if it was pancreatic or not.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated. Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 15:33:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Subsetting-by-unique-patient-IDs-and-other-criteria/m-p/542833#M150026</guid>
      <dc:creator>lady8506</dc:creator>
      <dc:date>2019-03-13T15:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Subsetting by unique patient IDs and other criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Subsetting-by-unique-patient-IDs-and-other-criteria/m-p/543277#M150170</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/131693"&gt;@lady8506&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You write you're already able to select the patient_id's you want. Below sample code shows you two ways how you then can select all rows in a table matching a list of such patient_id's.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  do pat_id=1 to 100;
    do row=1 to 5;
      if ranuni(1)&amp;gt;0.2 then diag='Other';
      else diag='Panc';
      output;
    end;
  end;
run;
  
/**
  option 1: Using SAS Data Step 
**/
data pat_want(keep=pat_id);
  set have;
  by pat_id;
  /* selection criteria */
  if row=1 and diag='Panc';
run;

data want1;
  if _n_=1 then 
    do;
      /* lookup table with list of unique pat_id's matching selection criteria */
      dcl hash h1(dataset:'pat_want');
      h1.defineKey('pat_id');
      h1.defineDone();
    end;
  set have;
  /* select all pat_id's from have with match to lookup table */
  if h1.check()=0 then output;
run;

/*
  Option 2: SQL
*/
proc sql;
  create table want2 as
    select h.*
    from 
      have h
      inner join
      (
        /* list of unique pat_id's matching selection criteria */
        select distinct pat_id
        from have 
        where row=1 and diag='Panc'
      ) s
      on h.pat_id=s.pat_id
    ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Mar 2019 18:04:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Subsetting-by-unique-patient-IDs-and-other-criteria/m-p/543277#M150170</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-03-14T18:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: Subsetting by unique patient IDs and other criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Subsetting-by-unique-patient-IDs-and-other-criteria/m-p/543326#M150185</link>
      <description>&lt;P&gt;You can do it all in one go:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
  input ID $ SEQ &amp;amp;: $50. SITE  &amp;amp;: $50. TYPE;
 cards;
16  1st of 2 or more primaries  C20.9 - Rectum, NOS  8140
16  2nd of 2 or more primaries  C20.9 - Rectum, NOS  8140
18  1st of 2 or more primaries  C20.9 - Rectum, NOS  8140
18  2nd of 2 or more primaries  C38.1-Anterior mediastinum  8801
22  1st of 2 or more primaries  C20.9 - Rectum, NOS  8140
22  2nd of 2 or more primaries  C42.1-Bone marrow  9732
22  3rd of 3 or more primaries  C50.9-Breast, NOS  8500
25  One primary only  C25.2-Tail of pancreas  8246
31  4th of 4 or more primaries  C50.4-Upper-outer quadrant of breast  8500
31  5th of 5 or more primaries  C34.1-Upper lobe, lung  8070
32  1st of 2 or more primaries  C25.0-Head of pancreas  8155
32  2nd of 2 or more primaries  C64.9-Kidney, NOS  8312
run;

data WANT;
  retain KEEP;
  set HAVE;
  by ID;
  if first.ID then KEEP=( SEQ in:('One', '1st') and index(SITE ,'ancreas'));
  if KEEP;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set TEMPDATA.WANT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;&lt;COLGROUP&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l header" scope="col"&gt;ID&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;SEQ&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;SITE&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;25&lt;/TD&gt;
&lt;TD class="l data"&gt;One primary only&lt;/TD&gt;
&lt;TD class="l data"&gt;C25.2-Tail of pancreas&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;32&lt;/TD&gt;
&lt;TD class="l data"&gt;1st of 2 or more primaries&lt;/TD&gt;
&lt;TD class="l data"&gt;C25.0-Head of pancreas&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;32&lt;/TD&gt;
&lt;TD class="l data"&gt;2nd of 2 or more primaries&lt;/TD&gt;
&lt;TD class="l data"&gt;C64.9-Kidney, NOS&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 21:50:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Subsetting-by-unique-patient-IDs-and-other-criteria/m-p/543326#M150185</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-03-14T21:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: Subsetting by unique patient IDs and other criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Subsetting-by-unique-patient-IDs-and-other-criteria/m-p/543529#M150263</link>
      <description>&lt;P&gt;This is fantastic! I am unfamiliar with some of the syntax you used, but I will figure it out. For now, it looks like it worked. My original dataset is over 1 million observations long and now, after implementing your code, it's only 6500+ long. That seems about right as another study was done drawing data from SEER (same place I got my data) and they ended up with only 3300+ pancreatic cancer patients, but they also weren't including subsequent cancers of other non-pancreatic types like I did. I just need to check it over and make sure before I accept as final solution.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 13:34:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Subsetting-by-unique-patient-IDs-and-other-criteria/m-p/543529#M150263</guid>
      <dc:creator>lady8506</dc:creator>
      <dc:date>2019-03-15T13:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: Subsetting by unique patient IDs and other criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Subsetting-by-unique-patient-IDs-and-other-criteria/m-p/543666#M150303</link>
      <description>Ask if you get stuck on some of the syntax. Note that the expression giving its value to KEEP is just a test. So it yields a Boolean result. &lt;BR /&gt;</description>
      <pubDate>Fri, 15 Mar 2019 21:18:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Subsetting-by-unique-patient-IDs-and-other-criteria/m-p/543666#M150303</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-03-15T21:18:26Z</dc:date>
    </item>
  </channel>
</rss>

