<?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: SUBSTRING in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SUBSTRING/m-p/841322#M332654</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;text2 = compress(text, 'Y', 'ki');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Use &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.2/lefunctionsref/n0fcshr0ir3h73n1b845c4aq58hz.htm#n1mi06lpn9ak5yn14q584vlzg32v" target="_self"&gt;COMPRESS with the modifiers&lt;/A&gt;, k for keep and i for ignoring case.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/427963"&gt;@MK_96&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;HOW CAN I EXTRACT ONLY "Y" VALUES TO NEW VARIABLE FROM BELOW CODE .?&lt;BR /&gt;IS THERE ANY FUNCTION THAT WORKS ??&lt;BR /&gt;&lt;BR /&gt;DATA CHK;&lt;BR /&gt;TEXT="122 AGH Y yy jaja Yy &amp;amp;#^#7aa ";&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Oct 2022 15:39:09 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2022-10-28T15:39:09Z</dc:date>
    <item>
      <title>SUBSTRING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTRING/m-p/841314#M332648</link>
      <description>HOW CAN I EXTRACT ONLY "Y" VALUES TO NEW VARIABLE FROM BELOW CODE .?&lt;BR /&gt;IS THERE ANY FUNCTION THAT WORKS ??&lt;BR /&gt;&lt;BR /&gt;DATA CHK;&lt;BR /&gt;TEXT="122 AGH Y yy jaja Yy &amp;amp;#^#7aa ";&lt;BR /&gt;RUN;&lt;BR /&gt;</description>
      <pubDate>Fri, 28 Oct 2022 15:03:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTRING/m-p/841314#M332648</guid>
      <dc:creator>MK_96</dc:creator>
      <dc:date>2022-10-28T15:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTRING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTRING/m-p/841318#M332651</link>
      <description>&lt;P&gt;Please explain further. What is the desired output from "extract Y values"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please do not type in all capitals.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 15:24:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTRING/m-p/841318#M332651</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-10-28T15:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTRING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTRING/m-p/841321#M332653</link>
      <description>Only y values should be in new variable</description>
      <pubDate>Fri, 28 Oct 2022 15:36:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTRING/m-p/841321#M332653</guid>
      <dc:creator>MK_96</dc:creator>
      <dc:date>2022-10-28T15:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTRING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTRING/m-p/841322#M332654</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;text2 = compress(text, 'Y', 'ki');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Use &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.2/lefunctionsref/n0fcshr0ir3h73n1b845c4aq58hz.htm#n1mi06lpn9ak5yn14q584vlzg32v" target="_self"&gt;COMPRESS with the modifiers&lt;/A&gt;, k for keep and i for ignoring case.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/427963"&gt;@MK_96&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;HOW CAN I EXTRACT ONLY "Y" VALUES TO NEW VARIABLE FROM BELOW CODE .?&lt;BR /&gt;IS THERE ANY FUNCTION THAT WORKS ??&lt;BR /&gt;&lt;BR /&gt;DATA CHK;&lt;BR /&gt;TEXT="122 AGH Y yy jaja Yy &amp;amp;#^#7aa ";&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 15:39:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTRING/m-p/841322#M332654</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-10-28T15:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTRING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTRING/m-p/841324#M332655</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/427963"&gt;@MK_96&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;HOW CAN I EXTRACT ONLY "Y" VALUES TO NEW VARIABLE FROM BELOW CODE .?&lt;BR /&gt;IS THERE ANY FUNCTION THAT WORKS ??&lt;BR /&gt;&lt;BR /&gt;DATA CHK;&lt;BR /&gt;TEXT="122 AGH Y yy jaja Yy &amp;amp;#^#7aa ";&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There are probably multiple functions that work depend on what the desired result actually is.&lt;/P&gt;
&lt;P&gt;If you want to remove the Y, first you have tell us if that means remove the lower case y as well. I say this because you are using all capital letters so it is not clear.&lt;/P&gt;
&lt;P&gt;Here are just some of the possible examples&lt;/P&gt;
&lt;PRE&gt;DATA CHK;
TEXT="122 AGH Y yy jaja Yy &amp;amp;#^#7aa ";
text2 = compress(text,'Y');
text3 = compress(text,'y');
text4 = compress(text,'Y','i');
text5 = compress(text,'Y','ik');
text6 = translate(text,'  ','Yy');

RUN;&lt;/PRE&gt;
&lt;P&gt;Compress removes characters. Examples show just upper case Y, lower case Y, case insensitive Y, remove everything except the case insensitive Y's (extracted from the string and KEPT). Translate replaces characters with a different single character.&lt;/P&gt;
&lt;P&gt;TRANWRD might be another option as well as regular expressions.&lt;/P&gt;
&lt;P&gt;But since you did not provide an example of what you expect this is all guesses as to what you may want.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 15:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTRING/m-p/841324#M332655</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-10-28T15:43:30Z</dc:date>
    </item>
  </channel>
</rss>

