<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/scan/m-p/747614#M234688</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.ds;
    input my_string $1-50;
    datalines;
World/Europe*Spain/Madrid
World/Europe*France/Paris
World/Latin-America/Argentina/Buenos Aires
World/Latin-America*Peru/Lima
;
run;
 
 
data work.ds_scan_slash;
    set work.ds;
     
    my_scan_slash = scan(my_string, 3,'*');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Required Output&lt;/P&gt;
&lt;TABLE class="table" style="height: 431px; width: 431px;" width="431" aria-label="Data Set WORK.DS_SCAN_SLASH"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="header" scope="col" width="9px"&gt;&amp;nbsp;&lt;/TH&gt;
&lt;TH class="header" scope="col" width="327px"&gt;my_string&lt;/TH&gt;
&lt;TH class="header" scope="col" width="95px"&gt;my_scan_slash&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row" width="9px"&gt;1&lt;/TH&gt;
&lt;TD width="327px" class="data"&gt;World/Europe/Spain/Madrid&lt;/TD&gt;
&lt;TD width="95px" class="data"&gt;Spain&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row" width="9px"&gt;2&lt;/TH&gt;
&lt;TD width="327px" class="data"&gt;World/Europe/France/Paris&lt;/TD&gt;
&lt;TD width="95px" class="data"&gt;France&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row" width="9px"&gt;3&lt;/TH&gt;
&lt;TD width="327px" class="data"&gt;World/Latin-America/Argentina/Buenos Aires&lt;/TD&gt;
&lt;TD width="95px" class="data"&gt;Argentina&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row" width="9px"&gt;4&lt;/TH&gt;
&lt;TD width="327px" class="data"&gt;World/Latin-America/Peru/Lima&lt;/TD&gt;
&lt;TD width="95px" class="data"&gt;Peru&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
    <pubDate>Sun, 13 Jun 2021 13:33:23 GMT</pubDate>
    <dc:creator>BrahmanandaRao</dc:creator>
    <dc:date>2021-06-13T13:33:23Z</dc:date>
    <item>
      <title>scan</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scan/m-p/747614#M234688</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.ds;
    input my_string $1-50;
    datalines;
World/Europe*Spain/Madrid
World/Europe*France/Paris
World/Latin-America/Argentina/Buenos Aires
World/Latin-America*Peru/Lima
;
run;
 
 
data work.ds_scan_slash;
    set work.ds;
     
    my_scan_slash = scan(my_string, 3,'*');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Required Output&lt;/P&gt;
&lt;TABLE class="table" style="height: 431px; width: 431px;" width="431" aria-label="Data Set WORK.DS_SCAN_SLASH"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="header" scope="col" width="9px"&gt;&amp;nbsp;&lt;/TH&gt;
&lt;TH class="header" scope="col" width="327px"&gt;my_string&lt;/TH&gt;
&lt;TH class="header" scope="col" width="95px"&gt;my_scan_slash&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row" width="9px"&gt;1&lt;/TH&gt;
&lt;TD width="327px" class="data"&gt;World/Europe/Spain/Madrid&lt;/TD&gt;
&lt;TD width="95px" class="data"&gt;Spain&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row" width="9px"&gt;2&lt;/TH&gt;
&lt;TD width="327px" class="data"&gt;World/Europe/France/Paris&lt;/TD&gt;
&lt;TD width="95px" class="data"&gt;France&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row" width="9px"&gt;3&lt;/TH&gt;
&lt;TD width="327px" class="data"&gt;World/Latin-America/Argentina/Buenos Aires&lt;/TD&gt;
&lt;TD width="95px" class="data"&gt;Argentina&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row" width="9px"&gt;4&lt;/TH&gt;
&lt;TD width="327px" class="data"&gt;World/Latin-America/Peru/Lima&lt;/TD&gt;
&lt;TD width="95px" class="data"&gt;Peru&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Sun, 13 Jun 2021 13:33:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scan/m-p/747614#M234688</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2021-06-13T13:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: scan</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scan/m-p/747623#M234694</link>
      <description>&lt;P&gt;Hi &lt;A class="trigger-hovercard" style="color: #007dc3;" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860" target="_blank"&gt;Anandkvn&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All you need to do is add / to your list of separators:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.ds_scan_slash;
    set work.ds;
    my_scan_slash = scan(my_string, 3,'/*');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Jun 2021 15:25:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scan/m-p/747623#M234694</guid>
      <dc:creator>LeonidBatkhan</dc:creator>
      <dc:date>2021-06-13T15:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: scan</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scan/m-p/747674#M234719</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/51532"&gt;@LeonidBatkhan&lt;/a&gt;'s answer is a good one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could also translate the '*' to a '/" and then scan.&amp;nbsp; Like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.ds;
    input my_string $1-50;
    datalines;
World/Europe*Spain/Madrid
World/Europe*France/Paris
World/Latin-America/Argentina/Buenos Aires
World/Latin-America*Peru/Lima
;
run;
 
data work.ds_scan_slash;
	set work.ds;
	     
	My_String		=	TRANSLATE(My_String, '/', '*');
	my_scan_slash 	= 	scan(my_string, 3,'/');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 04:24:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scan/m-p/747674#M234719</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-06-14T04:24:57Z</dc:date>
    </item>
  </channel>
</rss>

