<?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 Subset based on the first 3 integers of a list in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Subset-based-on-the-first-3-integers-of-a-list/m-p/920483#M41246</link>
    <description>&lt;P&gt;Hi guys, suppose to have the following two datasets:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data set1;&lt;BR /&gt;input Variable1;&lt;BR /&gt;cards;&lt;BR /&gt;71515&lt;/P&gt;
&lt;P&gt;48041&lt;/P&gt;
&lt;P&gt;85201&lt;/P&gt;
&lt;P&gt;51881&lt;/P&gt;
&lt;P&gt;4329&lt;/P&gt;
&lt;P&gt;85220&lt;/P&gt;
&lt;P&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data set2;&lt;BR /&gt;input MyVariable;&lt;BR /&gt;cards;&lt;BR /&gt;390&lt;/P&gt;
&lt;P&gt;852&lt;/P&gt;
&lt;P&gt;715&lt;/P&gt;
&lt;P&gt;411&lt;/P&gt;
&lt;P&gt;465&lt;/P&gt;
&lt;P&gt;517&lt;/P&gt;
&lt;P&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to subset from set1 basd on the list in set 2? Required match: first 3 numbers (so all) in set2 MUST match at the beginning the first 3 numbers in Varibale1 from set 1.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: numbers in set2 are always composed by 3 integers. Thank you in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Desired output:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data Output;&lt;BR /&gt;input Variable_output;&lt;BR /&gt;cards;&lt;/P&gt;
&lt;P&gt;71515&lt;/P&gt;
&lt;P&gt;85201&lt;/P&gt;
&lt;P&gt;85220&lt;/P&gt;
&lt;P&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Mar 2024 16:55:45 GMT</pubDate>
    <dc:creator>NewUsrStat</dc:creator>
    <dc:date>2024-03-15T16:55:45Z</dc:date>
    <item>
      <title>Subset based on the first 3 integers of a list</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Subset-based-on-the-first-3-integers-of-a-list/m-p/920483#M41246</link>
      <description>&lt;P&gt;Hi guys, suppose to have the following two datasets:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data set1;&lt;BR /&gt;input Variable1;&lt;BR /&gt;cards;&lt;BR /&gt;71515&lt;/P&gt;
&lt;P&gt;48041&lt;/P&gt;
&lt;P&gt;85201&lt;/P&gt;
&lt;P&gt;51881&lt;/P&gt;
&lt;P&gt;4329&lt;/P&gt;
&lt;P&gt;85220&lt;/P&gt;
&lt;P&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data set2;&lt;BR /&gt;input MyVariable;&lt;BR /&gt;cards;&lt;BR /&gt;390&lt;/P&gt;
&lt;P&gt;852&lt;/P&gt;
&lt;P&gt;715&lt;/P&gt;
&lt;P&gt;411&lt;/P&gt;
&lt;P&gt;465&lt;/P&gt;
&lt;P&gt;517&lt;/P&gt;
&lt;P&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to subset from set1 basd on the list in set 2? Required match: first 3 numbers (so all) in set2 MUST match at the beginning the first 3 numbers in Varibale1 from set 1.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: numbers in set2 are always composed by 3 integers. Thank you in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Desired output:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data Output;&lt;BR /&gt;input Variable_output;&lt;BR /&gt;cards;&lt;/P&gt;
&lt;P&gt;71515&lt;/P&gt;
&lt;P&gt;85201&lt;/P&gt;
&lt;P&gt;85220&lt;/P&gt;
&lt;P&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 16:55:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Subset-based-on-the-first-3-integers-of-a-list/m-p/920483#M41246</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-03-15T16:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: Subset based on the first 3 integers of a list</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Subset-based-on-the-first-3-integers-of-a-list/m-p/920484#M41247</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc SQL;
     select varlabel1 from set1 
     where substr(varlabel1,1,3) in (select distinct myvariable from set2);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Mar 2024 17:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Subset-based-on-the-first-3-integers-of-a-list/m-p/920484#M41247</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-03-15T17:14:25Z</dc:date>
    </item>
  </channel>
</rss>

