<?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: Code to filter values that are concatenated in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Code-to-filter-values-that-are-concatenated/m-p/947304#M370864</link>
    <description>&lt;P&gt;Here you go:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
  input concat :$20.;
/*  if index(concat, '202406') ne 1;*/
  if scan(concat,1,'_') ne '202406';
  datalines;
202401_Base
202401_Medium
202401_High
202402_Base
202402_Medium
202402_High
202403_Base
202403_Medium
202403_High
202404_Base
202404_Medium
202404_High
202405_Base
202405_Medium
202405_High
202406_Base
202406_Medium
202406_High
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Btw: If you copy/paste your question including the sample data as is into an AI tool like chatGPT or copilot then you will likely get valid code.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Oct 2024 02:10:19 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2024-10-14T02:10:19Z</dc:date>
    <item>
      <title>Code to filter values that are concatenated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-filter-values-that-are-concatenated/m-p/947297#M370862</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've got a variable called 'concat' (character variable). Please can someone provide some code that would help me to just keep all values of 'concat' which doesn't have 202406 in it i.e. keep first 15 records and remove last three records in my dataset?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Concat&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;202401_Base&lt;/P&gt;
&lt;P&gt;202401_Medium&lt;/P&gt;
&lt;P&gt;202401_High&lt;/P&gt;
&lt;P&gt;202402_Base&lt;/P&gt;
&lt;P&gt;202402_Medium&lt;/P&gt;
&lt;P&gt;202402_High&lt;/P&gt;
&lt;P&gt;202403_Base&lt;/P&gt;
&lt;P&gt;202403_Medium&lt;/P&gt;
&lt;P&gt;202403_High&lt;/P&gt;
&lt;P&gt;202404_Base&lt;/P&gt;
&lt;P&gt;202404_Medium&lt;/P&gt;
&lt;P&gt;202404_High&lt;/P&gt;
&lt;P&gt;202405_Base&lt;/P&gt;
&lt;P&gt;202405_Medium&lt;/P&gt;
&lt;P&gt;202405_High&lt;/P&gt;
&lt;P&gt;202406_Base&lt;/P&gt;
&lt;P&gt;202406_Medium&lt;/P&gt;
&lt;P&gt;202406_High&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 00:07:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-filter-values-that-are-concatenated/m-p/947297#M370862</guid>
      <dc:creator>Justin9</dc:creator>
      <dc:date>2024-10-14T00:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: Code to filter values that are concatenated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-filter-values-that-are-concatenated/m-p/947303#M370863</link>
      <description>If the date always appears at the beginning of CONCAT, subsetting is easy:&lt;BR /&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;if concat =: "202406" then delete;&lt;BR /&gt;run;&lt;BR /&gt;If 202406 might appear in the middle of CONCAT instead of the beginning, it is only slightly more complex. Which is it?</description>
      <pubDate>Mon, 14 Oct 2024 01:50:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-filter-values-that-are-concatenated/m-p/947303#M370863</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2024-10-14T01:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Code to filter values that are concatenated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-filter-values-that-are-concatenated/m-p/947304#M370864</link>
      <description>&lt;P&gt;Here you go:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
  input concat :$20.;
/*  if index(concat, '202406') ne 1;*/
  if scan(concat,1,'_') ne '202406';
  datalines;
202401_Base
202401_Medium
202401_High
202402_Base
202402_Medium
202402_High
202403_Base
202403_Medium
202403_High
202404_Base
202404_Medium
202404_High
202405_Base
202405_Medium
202405_High
202406_Base
202406_Medium
202406_High
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Btw: If you copy/paste your question including the sample data as is into an AI tool like chatGPT or copilot then you will likely get valid code.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 02:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-filter-values-that-are-concatenated/m-p/947304#M370864</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-10-14T02:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Code to filter values that are concatenated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-to-filter-values-that-are-concatenated/m-p/947305#M370865</link>
      <description>Thanks for your help!</description>
      <pubDate>Mon, 14 Oct 2024 01:57:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-to-filter-values-that-are-concatenated/m-p/947305#M370865</guid>
      <dc:creator>Justin9</dc:creator>
      <dc:date>2024-10-14T01:57:56Z</dc:date>
    </item>
  </channel>
</rss>

