<?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 subset data based on a list of values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-subset-data-based-on-a-list-of-values/m-p/767192#M243194</link>
    <description>People are going to get mad at you if you don’t paste the datasets as datalines.</description>
    <pubDate>Sat, 11 Sep 2021 10:47:00 GMT</pubDate>
    <dc:creator>tarheel13</dc:creator>
    <dc:date>2021-09-11T10:47:00Z</dc:date>
    <item>
      <title>How to subset data based on a list of values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-subset-data-based-on-a-list-of-values/m-p/767191#M243193</link>
      <description>I have a huge dataset that I want to subset based on values that already exist in another dataset. For example:&lt;BR /&gt;&lt;BR /&gt;Dataset A&lt;BR /&gt;&lt;BR /&gt;ID Dollars&lt;BR /&gt;1 100&lt;BR /&gt;2 135&lt;BR /&gt;&lt;BR /&gt;Dataset B&lt;BR /&gt;&lt;BR /&gt;Key Age App Funds&lt;BR /&gt;1 23 1 1000&lt;BR /&gt;1 23 2 1500&lt;BR /&gt;2 22 1 6700&lt;BR /&gt;2 22 2 2000&lt;BR /&gt;3 26 1 3100&lt;BR /&gt;3 26 2 2300&lt;BR /&gt;&lt;BR /&gt;I wanted to create a list (maybe a macro list would be suitable?) based on the ID values from Dataset A, e.g.&lt;BR /&gt;IDlist = 1,2&lt;BR /&gt;&lt;BR /&gt;Then, I would like to subset Dataset B based on ID’s that exist in our previously created IDlist. And I would use this in a proc sql (or data step) like:&lt;BR /&gt;&lt;BR /&gt;proc sql:&lt;BR /&gt;create table want as&lt;BR /&gt;Select *&lt;BR /&gt;From B&lt;BR /&gt;Where key in IDlist;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;The ideal subsetted dataset B should look like:&lt;BR /&gt;&lt;BR /&gt;Data want:&lt;BR /&gt;&lt;BR /&gt;Key Age App Funds&lt;BR /&gt;1 23 1 1000&lt;BR /&gt;1 23 2 1500&lt;BR /&gt;2 22 1 6700&lt;BR /&gt;2 22 2 2000&lt;BR /&gt;&lt;BR /&gt;If anyone has dealt with something like this before, I’d appreciate any input. Thank you!</description>
      <pubDate>Sat, 11 Sep 2021 10:18:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-subset-data-based-on-a-list-of-values/m-p/767191#M243193</guid>
      <dc:creator>msyteriouspages</dc:creator>
      <dc:date>2021-09-11T10:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to subset data based on a list of values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-subset-data-based-on-a-list-of-values/m-p/767192#M243194</link>
      <description>People are going to get mad at you if you don’t paste the datasets as datalines.</description>
      <pubDate>Sat, 11 Sep 2021 10:47:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-subset-data-based-on-a-list-of-values/m-p/767192#M243194</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-09-11T10:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to subset data based on a list of values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-subset-data-based-on-a-list-of-values/m-p/767193#M243195</link>
      <description>Hi, sorry, I’m new to SAS communities. Any tips on how I could paste them as datalines?</description>
      <pubDate>Sat, 11 Sep 2021 10:50:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-subset-data-based-on-a-list-of-values/m-p/767193#M243195</guid>
      <dc:creator>msyteriouspages</dc:creator>
      <dc:date>2021-09-11T10:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to subset data based on a list of values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-subset-data-based-on-a-list-of-values/m-p/767195#M243196</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data A;
input ID dollars;
datalines;
1 100
2 135
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Like that. Also, if you are posting code, please use the insert SAS code button.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Sep 2021 11:02:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-subset-data-based-on-a-list-of-values/m-p/767195#M243196</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-09-11T11:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to subset data based on a list of values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-subset-data-based-on-a-list-of-values/m-p/767198#M243197</link>
      <description>proc sql:&lt;BR /&gt;create table want as&lt;BR /&gt;Select *&lt;BR /&gt;From B&lt;BR /&gt;Where key in  (select id from A)  ;&lt;BR /&gt;quit;</description>
      <pubDate>Sat, 11 Sep 2021 11:19:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-subset-data-based-on-a-list-of-values/m-p/767198#M243197</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-09-11T11:19:35Z</dc:date>
    </item>
  </channel>
</rss>

