<?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 do I get the first part of the string using %scan in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-first-part-of-the-string-using-scan/m-p/359248#M274480</link>
    <description>What are you expecting to get from %put %scan(%superq(a),2,%str(@));?&lt;BR /&gt;From your example string, there are no text after the '@' character.</description>
    <pubDate>Wed, 17 May 2017 02:49:16 GMT</pubDate>
    <dc:creator>AhmedAl_Attar</dc:creator>
    <dc:date>2017-05-17T02:49:16Z</dc:date>
    <item>
      <title>How do I get the first part of the string using %scan</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-first-part-of-the-string-using-scan/m-p/359242#M274476</link>
      <description>&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Hello experts,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if I have a string defined as &amp;amp;a and I want to grab all the string prior to @ from the whole string as defined by the %macro a %put. how do I achieve the result?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;the following macro a is not working...&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; a=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%str&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(SELECT a.ITS_ORIG_STN_CD , a.ITS_ORIG_STN_DS , b.CODE_CD, b.SUB_CODE_CD, b.CODE_TYPE_GP, b.CODE_LITERAL_DS from DS_LEAP.DS_ACCUSED a INNER JOIN DS_LEAP.DS_CODE_TABLE b ON ( a.ITS_ORIG_STN_CD = b.CODE_CD ) WHERE b.CODE_TYPE_GP = '0026' AND a.ITS_ORIG_STN_DS &amp;lt;&amp;gt; b.CODE_LITERAL_DS@a);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &lt;STRONG&gt;&lt;I&gt;a&lt;/I&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%put&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%scan&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%nrstr&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(&amp;amp;a),1,'@');&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;a&lt;/I&gt;&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2017 01:30:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-first-part-of-the-string-using-scan/m-p/359242#M274476</guid>
      <dc:creator>gyambqt</dc:creator>
      <dc:date>2017-05-17T01:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the first part of the string using %scan</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-first-part-of-the-string-using-scan/m-p/359243#M274477</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let a= %str(SELECT a.ITS_ORIG_STN_CD,a.ITS_ORIG_STN_DS,b.CODE_CD, b.SUB_CODE_CD,b.CODE_TYPE_GP,b.CODE_LITERAL_DS from DS_LEAP.DS_ACCUSED a INNER JOIN DS_LEAP.DS_CODE_TABLE b ON ( a.ITS_ORIG_STN_CD = b.CODE_CD ) WHERE b.CODE_TYPE_GP = '0026' AND a.ITS_ORIG_STN_DS &amp;lt;&amp;gt; b.CODE_LITERAL_DS@a);

%macro a;
 %put %scan(%superq(a),1,%str(@));
%mend;
%a;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Ahmed&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2017 01:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-first-part-of-the-string-using-scan/m-p/359243#M274477</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2017-05-17T01:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the first part of the string using %scan</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-first-part-of-the-string-using-scan/m-p/359244#M274478</link>
      <description>thanks for your reply but it doesn't work when you try&lt;BR /&gt;%put %scan(%superq(a),2,%str(@));</description>
      <pubDate>Wed, 17 May 2017 01:55:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-first-part-of-the-string-using-scan/m-p/359244#M274478</guid>
      <dc:creator>gyambqt</dc:creator>
      <dc:date>2017-05-17T01:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the first part of the string using %scan</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-first-part-of-the-string-using-scan/m-p/359245#M274479</link>
      <description>&lt;P&gt;Have you tried removing the quotes from the third parameter: &amp;nbsp;@ instead of '@'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The quotes aren't needed, and therefore indicate that quotes are one of the characters that %SCAN should use as a delimiter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%SUPERQ (as was suggested) is a good idea as well:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro a;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; %put %scan(%super(a), 1,&amp;nbsp;@ );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%mend a;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2017 02:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-first-part-of-the-string-using-scan/m-p/359245#M274479</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-05-17T02:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the first part of the string using %scan</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-first-part-of-the-string-using-scan/m-p/359248#M274480</link>
      <description>What are you expecting to get from %put %scan(%superq(a),2,%str(@));?&lt;BR /&gt;From your example string, there are no text after the '@' character.</description>
      <pubDate>Wed, 17 May 2017 02:49:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-get-the-first-part-of-the-string-using-scan/m-p/359248#M274480</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2017-05-17T02:49:16Z</dc:date>
    </item>
  </channel>
</rss>

