<?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 flag a range of characters from multiple columns to create a new variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644773#M192644</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292097"&gt;@ed_sas_member&lt;/a&gt;&amp;nbsp; for all your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp; for the merge.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;BR /&gt;Rebecca&lt;/P&gt;</description>
    <pubDate>Sat, 02 May 2020 19:14:39 GMT</pubDate>
    <dc:creator>RAGC</dc:creator>
    <dc:date>2020-05-02T19:14:39Z</dc:date>
    <item>
      <title>How to flag a range of characters from multiple columns to create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644758#M192633</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on a large dataset that lists all follow-up conditions in a range of columns using ICD10 codes. ICD10 codes thankfully have a similar pattern where there is a letter and then a range of number for similar disorders (e.g. Cancer is C000 to C969). I want to go through each column and create a new variable if the person has had one of those types of disorders. I have provided an example below. Disease_X_0 is the column with the ICD10 code, and Cancer is the new variable I would like to create.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Disease_1_0&lt;/TD&gt;&lt;TD&gt;Disease_2_0&lt;/TD&gt;&lt;TD&gt;Disease_3_0&lt;/TD&gt;&lt;TD&gt;Disease_4_0&lt;/TD&gt;&lt;TD&gt;Cancer&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;C001&lt;/TD&gt;&lt;TD&gt;B005&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;D55&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;C97&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;C97&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;K00&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;D57&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I feel like there is an easy way to do this but cannot seem to find it with all my googling! Thank you so much in advance for your time!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2020 18:21:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644758#M192633</guid>
      <dc:creator>RAGC</dc:creator>
      <dc:date>2020-05-02T18:21:48Z</dc:date>
    </item>
    <item>
      <title>Flagging a range of characters to create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644755#M192641</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on a large dataset that lists all follow-up conditions in a range of columns using ICD10 codes. ICD10 codes thankfully have a similar pattern where there is a letter and then a range of number for similar disorders (e.g. Cancer is C000 to C969). I want to go through each column and create a new variable if the person has had one of those types of disorders. I have provided an example below. Disease_X_0 is the column with the ICD10 code, and Cancer is the new variable I would like to create.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Disease_1_0&lt;/TD&gt;&lt;TD&gt;Disease_2_0&lt;/TD&gt;&lt;TD&gt;Disease_3_0&lt;/TD&gt;&lt;TD&gt;Disease_4_0&lt;/TD&gt;&lt;TD&gt;Cancer&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;C001&lt;/TD&gt;&lt;TD&gt;B005&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;D55&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;C97&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;C97&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;K00&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;D57&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I feel like there is an easy way to do this but cannot seem to find it with all my googling! Thank you so much in advance for your time!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2020 18:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644755#M192641</guid>
      <dc:creator>RAGC</dc:creator>
      <dc:date>2020-05-02T18:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to flag a range of characters from multiple columns to create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644762#M192634</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/256756"&gt;@RAGC&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try the below code.&lt;/P&gt;
&lt;P&gt;The array function enables to perform the same manipulation on multiple variables.&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines dlm="," dsd missover;
	input ID Disease_1_0 $ Disease_2_0 $ Disease_3_0 $ Disease_4_0 $;
	datalines;
1,C001,B005,,
2,D55, ,C97,
3,,C97,,,
4,K00,,,,
5,,D57,,,
;
run;

data want;
	set have;
	array _Disease (*) Disease_:;
	cancer=0;
	do i=1 to dim(_Disease);
		if prxmatch('/C\d+/',_Disease(i))&amp;gt;0 then cancer=1; /* \d+ mean 1 digit or more */
	end;
	drop i;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Capture d’écran 2020-05-02 à 20.34.14.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39005i57E200A02DF94B66/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture d’écran 2020-05-02 à 20.34.14.png" alt="Capture d’écran 2020-05-02 à 20.34.14.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2020 18:35:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644762#M192634</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-02T18:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Flagging a range of characters to create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644766#M192642</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/256756"&gt;@RAGC&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try the below code. Please avoid duplicate posts&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The array function enables to perform the same manipulation on multiple variables.&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;data have;
	infile datalines dlm="," dsd missover;
	input ID Disease_1_0 $ Disease_2_0 $ Disease_3_0 $ Disease_4_0 $;
	datalines;
1,C001,B005,,
2,D55, ,C97,
3,,C97,,,
4,K00,,,,
5,,D57,,,
;
run;

data want;
	set have;
	array _Disease (*) Disease_:;
	cancer=0;
	do i=1 to dim(_Disease);
		if prxmatch('/C\d+/',_Disease(i))&amp;gt;0 then cancer=1; /* \d+ mean 1 digit or more */
	end;
	drop i;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2020 18:41:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644766#M192642</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-02T18:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to flag a range of characters from multiple columns to create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644767#M192636</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292097"&gt;@ed_sas_member&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My sincerest apologies for the duplicate posting! I realized I posted in the wrong section, and thought I had deleted it before posting it in here (which I hope is the appropriate section).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your code worked super well! Thank you so much! If you would indulge me for one step further that I am struggling with. I see that you mentioned the d+ is for anything greater than 1 digit. If there a way to specify a range of the values (e.g. C001 to C500) even though there are up to C969 available characters?.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;BR /&gt;Rebecca&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2020 18:48:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644767#M192636</guid>
      <dc:creator>RAGC</dc:creator>
      <dc:date>2020-05-02T18:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to flag a range of characters from multiple columns to create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644771#M192640</link>
      <description>&lt;P&gt;you’re welcome !&lt;BR /&gt;You can mention a range as follows in the prxmatch function:&lt;BR /&gt;/C[0-500]/&lt;BR /&gt;&lt;BR /&gt;If the ICD code must have 3 digits following the C letter, you can add this check :&lt;BR /&gt;AND prxmatch(‘/C\d\d\d/‘ ...)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if prxmatch('/C\d\d\d/',_Disease(i))&amp;gt;0 and prxmatch('/C[0-500]/',_Disease(i))&amp;gt;0  then cancer=1;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 02 May 2020 19:13:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644771#M192640</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-02T19:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to flag a range of characters from multiple columns to create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644772#M192643</link>
      <description>&lt;P&gt;Hi! I merged everything.&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2020 19:07:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644772#M192643</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-02T19:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to flag a range of characters from multiple columns to create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644773#M192644</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292097"&gt;@ed_sas_member&lt;/a&gt;&amp;nbsp; for all your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp; for the merge.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;BR /&gt;Rebecca&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2020 19:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644773#M192644</guid>
      <dc:creator>RAGC</dc:creator>
      <dc:date>2020-05-02T19:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to flag a range of characters from multiple columns to create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644775#M192646</link>
      <description>You’re welcome Rebecca!&lt;BR /&gt;Have a wonderful day,&lt;BR /&gt;Best,</description>
      <pubDate>Sat, 02 May 2020 19:20:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644775#M192646</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-02T19:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to flag a range of characters from multiple columns to create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644779#M192649</link>
      <description>&lt;P&gt;Sorry&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/256756"&gt;@RAGC&lt;/a&gt;&amp;nbsp; Late to the party. Anyways, for what it's worth&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
	infile datalines dlm="," dsd missover;
	input ID Disease_1_0 $ Disease_2_0 $ Disease_3_0 $ Disease_4_0 $;
	datalines;
1,C001,B005,,
2,D55, ,C97,
3,,C97,,,
4,K00,,,,
5,,D57,,,
;
run;


data want;
 set have;
 array c(969) _temporary_  (1:969);
 array t Disease_1_0--Disease_4_0;
 do _n_=1 to dim(t) until(cancer=1);
  cancer= first(t(_n_))='C' and input(compress(t(_n_),,'kd'),best.) in c;
 end;
run;

proc print noobs;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;
&lt;/CODE&gt;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WANT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;ID&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;Disease_1_0&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;Disease_2_0&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;Disease_3_0&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;Disease_4_0&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;cancer&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="l data"&gt;C001&lt;/TD&gt;
&lt;TD class="l data"&gt;B005&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;TD class="l data"&gt;D55&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;C97&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;3&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;C97&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;TD class="l data"&gt;K00&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;5&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;D57&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Sat, 02 May 2020 20:21:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644779#M192649</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-05-02T20:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to flag a range of characters from multiple columns to create a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644781#M192650</link>
      <description>&lt;P&gt;Oops!, I took the list as 1:969 where I missed to start from 0 i.e. 0:969.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Correction:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
	infile datalines dlm="," dsd missover;
	input ID Disease_1_0 $ Disease_2_0 $ Disease_3_0 $ Disease_4_0 $;
	datalines;
1,C000,B005,,
2,D55, ,C97,
3,,C97,,,
4,K00,,,,
5,,D57,,,
;
run;


data want;
 set have;
 array c(000:969) _temporary_  (0:969);
 array t Disease_1_0--Disease_4_0;
 do _n_=1 to dim(t) until(cancer=1);
  cancer= first(t(_n_))='C' and input(compress(t(_n_),,'kd'),best.) in c;
 end;
run;

proc print noobs;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 02 May 2020 20:31:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-flag-a-range-of-characters-from-multiple-columns-to/m-p/644781#M192650</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-05-02T20:31:25Z</dc:date>
    </item>
  </channel>
</rss>

