<?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 scan if no value between 2 delimiter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/scan-if-no-value-between-2-delimiter/m-p/740807#M231474</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am trying to get the month or the following dates. The problem is when I use scan(dt,2) and if there is no value between 2 delimiter, it will be skipped.&amp;nbsp;Also, there is no means to know what is the delimiter. Could you please advise how can I get '2021//03' as year 2021 month missing and day 03?&lt;/P&gt;&lt;P&gt;Here are my testing code:&lt;/P&gt;&lt;PRE&gt;data yymmdd_de;
infile datalines delimiter=','; 
input dt $50.;
datalines;
21 03 14
21/03/14
21-03
21//03
21   03
;

data test;
set yymmdd_de;
m=scan(dt,2);
run;&lt;/PRE&gt;&lt;P&gt;Here is the result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scan.jpg" style="width: 311px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59275i6FC9C0D26878A52E/image-size/large?v=v2&amp;amp;px=999" role="button" title="scan.jpg" alt="scan.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 May 2021 14:20:20 GMT</pubDate>
    <dc:creator>tinaz5012</dc:creator>
    <dc:date>2021-05-12T14:20:20Z</dc:date>
    <item>
      <title>scan if no value between 2 delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scan-if-no-value-between-2-delimiter/m-p/740807#M231474</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am trying to get the month or the following dates. The problem is when I use scan(dt,2) and if there is no value between 2 delimiter, it will be skipped.&amp;nbsp;Also, there is no means to know what is the delimiter. Could you please advise how can I get '2021//03' as year 2021 month missing and day 03?&lt;/P&gt;&lt;P&gt;Here are my testing code:&lt;/P&gt;&lt;PRE&gt;data yymmdd_de;
infile datalines delimiter=','; 
input dt $50.;
datalines;
21 03 14
21/03/14
21-03
21//03
21   03
;

data test;
set yymmdd_de;
m=scan(dt,2);
run;&lt;/PRE&gt;&lt;P&gt;Here is the result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scan.jpg" style="width: 311px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59275i6FC9C0D26878A52E/image-size/large?v=v2&amp;amp;px=999" role="button" title="scan.jpg" alt="scan.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 14:20:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scan-if-no-value-between-2-delimiter/m-p/740807#M231474</guid>
      <dc:creator>tinaz5012</dc:creator>
      <dc:date>2021-05-12T14:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: scan if no value between 2 delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scan-if-no-value-between-2-delimiter/m-p/740809#M231476</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
set yymmdd_de;
m=scan(dt,2, "/- ", 'm');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0jshdjy2z9zdzn1h7k90u99lyq6.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0jshdjy2z9zdzn1h7k90u99lyq6.htm&lt;/A&gt;&lt;/P&gt;
&lt;TABLE class="xisDoc-listValueDescription"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="xisDoc-value"&gt;m or M&lt;/TD&gt;
&lt;TD class="xisDoc-valueDescription"&gt;specifies that multiple consecutive delimiters, and delimiters at the beginning or end of the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;string&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;argument, refer to words that have a length of zero. If the M modifier is not specified, then multiple consecutive delimiters are treated as one delimiter, and delimiters at the beginning or end of the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;string&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;argument are ignored.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Wed, 12 May 2021 14:27:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scan-if-no-value-between-2-delimiter/m-p/740809#M231476</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-05-12T14:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: scan if no value between 2 delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scan-if-no-value-between-2-delimiter/m-p/740810#M231477</link>
      <description>&lt;P&gt;Appreciate your response, it solve my problem. Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 14:31:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scan-if-no-value-between-2-delimiter/m-p/740810#M231477</guid>
      <dc:creator>tinaz5012</dc:creator>
      <dc:date>2021-05-12T14:31:37Z</dc:date>
    </item>
  </channel>
</rss>

