<?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 to read the variable that has 3 codesor more.. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486236#M126484</link>
    <description>&lt;P&gt;The third argument to the SCAN function can be a list of many possible delimiters, e.g. ",.; "&lt;/P&gt;</description>
    <pubDate>Mon, 13 Aug 2018 03:40:54 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2018-08-13T03:40:54Z</dc:date>
    <item>
      <title>how to read the variable that has 3 codesor more..</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486228#M126476</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a below sample data in excel that I import into sas..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Code&lt;/TD&gt;&lt;TD&gt;Code1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0122&lt;/TD&gt;&lt;TD&gt;WESXQI3C, BOUX17Q9, WESXYBWF&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4512&lt;/TD&gt;&lt;TD&gt;DENX9UPH; BLUX8Z3F; DENXDQQ3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2183&lt;/TD&gt;&lt;TD&gt;MOUNTADA, &amp;nbsp; BROWND01, BROWND03&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0122&lt;/TD&gt;&lt;TD&gt;CLARD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0130&lt;/TD&gt;&lt;TD&gt;BAXXB3OQ, BAXXKEQD BAXXEIAG&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0130&lt;/TD&gt;&lt;TD&gt;HUNTPA1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5221&lt;/TD&gt;&lt;TD&gt;MERXKIEI, MERXDW49,&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2183&lt;/TD&gt;&lt;TD&gt;LANX8M83, PROXEAKO, PROXEXMK, AABXJ2G7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4611&lt;/TD&gt;&lt;TD&gt;WEBXA56H, GERXDQN9 AEWEB GERXERSG JOYWEB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5251&lt;/TD&gt;&lt;TD&gt;DAWXR5D1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a master dataset to join on the code1&amp;nbsp;that has only one code indivually...so is there any function or sas code that I can run and create another dataset that has only one code1 list...i.e., to break them..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can use SCAN but the delimiters are , and ; and &amp;amp; and space...all different as they entered manually&amp;nbsp;in the excel data...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;appreciate your advice and thoughts...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;simple to get dataset like below...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;code1&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&g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&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 13 Aug 2018 02:36:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486228#M126476</guid>
      <dc:creator>BaalaRaaji</dc:creator>
      <dc:date>2018-08-13T02:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to read the variable that has 3 codesor more..</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486234#M126482</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
infile cards truncover;
input Code $	Code1 $100.;
cards4;
0122	WESXQI3C, BOUX17Q9, WESXYBWF
4512	DENX9UPH; BLUX8Z3F; DENXDQQ3
2183	MOUNTADA,   BROWND01, BROWND03
0122	CLARD
0130	BAXXB3OQ, BAXXKEQD BAXXEIAG
0130	HUNTPA1
5221	MERXKIEI, MERXDW49,
2183	LANX8M83, PROXEAKO, PROXEXMK, AABXJ2G7
4611	WEBXA56H, GERXDQN9 AEWEB GERXERSG JOYWEB
5251	DAWXR5D1
;;;;

data want;
set have;
k=char(code1,anypunct(code1));
k1=compress(code1,k);
do _n_=1 to countw(k1);
new_code=scan(k1,_n_);
output;
end;
keep code new_code;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Aug 2018 03:39:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486234#M126482</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-08-13T03:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to read the variable that has 3 codesor more..</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486236#M126484</link>
      <description>&lt;P&gt;The third argument to the SCAN function can be a list of many possible delimiters, e.g. ",.; "&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 03:40:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486236#M126484</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-08-13T03:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to read the variable that has 3 codesor more..</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486237#M126485</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want1;
set have;
k1=compress(code1,' ','kai');
do _n_=1 to countw(k1);
new_code=scan(k1,_n_);
output;
end;
keep code new_code;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Aug 2018 03:43:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486237#M126485</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-08-13T03:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to read the variable that has 3 codesor more..</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486238#M126486</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44464"&gt;@BaalaRaaji&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;If you can't be sure what the delimiters are but you can be sure what they won't be (letter or digit) then you could use the scan() function with an exclusion list (=everything not listed to be treated as delimiter).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below code demonstrates the approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines4 truncover;
  input Code $  Code1 $100.;
  datalines4;
0122  WESXQI3C, BOUX17Q9, WESXYBWF
4512  DENX9UPH; BLUX8Z3F; DENXDQQ3
2183  MOUNTADA,   BROWND01, BROWND03
0122  CLARD
0130  BAXXB3OQ, BAXXKEQD BAXXEIAG
0130  HUNTPA1
5221  MERXKIEI, MERXDW49,
2183  LANX8M83, PROXEAKO, PROXEXMK, AABXJ2G7
4611  WEBXA56H, GERXDQN9 AEWEB GERXERSG JOYWEB
5251  DAWXR5D1
;;;;
run;

data want;
  set have;
  length single_code $20;
  do _i=1 by 1;
    single_code=scan(code1,_i,,'KAD');
    if missing(single_code) then leave;
    else output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Aug 2018 04:01:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486238#M126486</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-08-13T04:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to read the variable that has 3 codesor more..</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486239#M126487</link>
      <description>&lt;P&gt;Thanks Patrick...that works amazingly...cheers!&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 04:04:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486239#M126487</guid>
      <dc:creator>BaalaRaaji</dc:creator>
      <dc:date>2018-08-13T04:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to read the variable that has 3 codesor more..</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486240#M126488</link>
      <description>&lt;P&gt;Hi Novinosrin..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it works but for few scenario...like 'and' &amp;nbsp;spaces and comma without space is not working correctly with your code.&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;code works exactly I wanted...later I can remove the numbers , and&amp;nbsp; symbols. Just cleaning the data...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you Novinsrin and Patrick...genies...&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 04:08:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486240#M126488</guid>
      <dc:creator>BaalaRaaji</dc:creator>
      <dc:date>2018-08-13T04:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to read the variable that has 3 codesor more..</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486347#M126532</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  do _i=1 to countw(code1,,'kad');
    single_code=scan(code1,_i,,'kad');
    output;
  end;
run;
proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Aug 2018 13:50:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-the-variable-that-has-3-codesor-more/m-p/486347#M126532</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-08-13T13:50:32Z</dc:date>
    </item>
  </channel>
</rss>

