<?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: Remove 'Master_Names' in the text? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Remove-Master-Names-in-the-text/m-p/687953#M208917</link>
    <description>&lt;P&gt;Have you tried using the Tranwrd function?&amp;nbsp; If the replacement value is '', then that should remove the text that you don't want.&amp;nbsp; You might want to run a COMPBL thereafter to compress any multiple spaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 19:17:23 GMT</pubDate>
    <dc:creator>jimbarbour</dc:creator>
    <dc:date>2020-09-30T19:17:23Z</dc:date>
    <item>
      <title>Remove 'Master_Names' in the text?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-Master-Names-in-the-text/m-p/687938#M208903</link>
      <description>&lt;P&gt;Hello, experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a sample dataset 'Have.'&amp;nbsp;&amp;nbsp; I would like to remove all&amp;nbsp; the names shown in the dataset 'Maste_Name.'&amp;nbsp;&amp;nbsp;&amp;nbsp; The final result is shown in the dataset 'Want.'&amp;nbsp;&amp;nbsp;&amp;nbsp; Please help me to approach it.&amp;nbsp;&amp;nbsp; Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data Master_Name;
      infile datalines dsd;
  input  Name : $50. ;
datalines;
	uairway,
	uapnea,
	ugastro,
	ugerd,
	uendo,
	uallergy
	;
run;


data Have;
      infile datalines delimiter='/';
  input Disease : $300.  ;
datalines;
	UGASTRO, UGERD, UALLERGY /
	UAIRWAY, CONGENITAL ATRESIA OF ESOPHA, UGASTRO /
	ECZEMA
;
run;

data Want;
      infile datalines delimiter='/';Re
  input Disease : $300.  ;
datalines;
	  /
	CONGENITAL ATRESIA OF ESOPHA /
	ECZEMA
;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Sep 2020 18:52:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-Master-Names-in-the-text/m-p/687938#M208903</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2020-09-30T18:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: Remove 'Master_Names' in the text?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-Master-Names-in-the-text/m-p/687953#M208917</link>
      <description>&lt;P&gt;Have you tried using the Tranwrd function?&amp;nbsp; If the replacement value is '', then that should remove the text that you don't want.&amp;nbsp; You might want to run a COMPBL thereafter to compress any multiple spaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 19:17:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-Master-Names-in-the-text/m-p/687953#M208917</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-30T19:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: Remove 'Master_Names' in the text?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-Master-Names-in-the-text/m-p/688001#M208922</link>
      <description>&lt;P&gt;For example, the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Master_Name;
      infile datalines dsd;
  input  Name : $50. ;
datalines;
uairway,
uapnea,
ugastro,
ugerd,
uendo,
uallergy
;
run;


data Have;
      infile datalines delimiter='/';
  input Disease : $300.  ;
datalines;
UGASTRO, UGERD, UALLERGY /
UAIRWAY, CONGENITAL ATRESIA OF ESOPHA, UGASTRO /
ECZEMA
;
run;

DATA	_NULL_;
	CALL	SYMPUTX('Names_Cnt', Names_Cnt, 'G');
	STOP;
	SET	Master_Name	NOBS	=	Names_Cnt;
RUN;

DATA	Want;
	DROP	Name;
	DROP	_:;

	ARRAY	Names	[&amp;amp;Names_Cnt]	$50	_TEMPORARY_;
	SET	Have;

	IF	_N_	=	1	THEN
		DO;
			DO	WHILE	(NOT	End_Of_Master);
				SET	Master_Name
					END		=	End_of_Master
					;
				_i			+	1;
				Names[_i]	=	Name;
			END;
		END;

	DO	_i		=	1	TO	&amp;amp;Names_Cnt;
		Disease	=	COMPBL(TRANWRD(UPCASE(Disease), CATS(UPCASE(Names[_i]), ','), ''));
		IF	SUBSTR(Disease, LENGTH(TRIM(Disease)), 1)	=	','	THEN
			Disease	=	SUBSTR(Disease, 1, LENGTH(STRIP(Disease)) - 1);
		Disease	=	COMPBL(TRANWRD(UPCASE(Disease), STRIP(UPCASE(Names[_i])), ''));
		IF	SUBSTR(Disease, LENGTH(TRIM(Disease)), 1)	=	','	THEN
			Disease	=	SUBSTR(Disease, 1, LENGTH(STRIP(Disease)) - 1);
	END;

	IF	NOT	INDEX(Disease, '/')	THEN
		Disease	=	CAT(STRIP(Disease), ' /');		
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which yields:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_0-1601497011224.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/50012i2AC5230C53865407/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jimbarbour_0-1601497011224.png" alt="jimbarbour_0-1601497011224.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 20:17:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-Master-Names-in-the-text/m-p/688001#M208922</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-30T20:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: Remove 'Master_Names' in the text?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-Master-Names-in-the-text/m-p/688182#M209011</link>
      <description>&lt;PRE&gt;data Master_Name;
      infile datalines dsd;
  input  Name : $50. ;
datalines;
uairway,
uapnea,
ugastro,
ugerd,
uendo,
uallergy
;
run;


data Have;
      infile datalines delimiter='/';
  input Disease : $300.  ;
datalines;
UGASTRO, UGERD, UALLERGY /
UAIRWAY, CONGENITAL ATRESIA OF ESOPHA, UGASTRO /
ECZEMA
;
run;


options noquotelenmax;
proc sql noprint;
select name into : names separated by '|' from master_name;
quit;

%put &amp;amp;names;

data want;
 set have;
 want=tranwrd(prxchange("s/\b&amp;amp;names\b/ /i",-1,disease),' ,',' ');
 run;

&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Oct 2020 12:59:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-Master-Names-in-the-text/m-p/688182#M209011</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-10-01T12:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: Remove 'Master_Names' in the text?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-Master-Names-in-the-text/m-p/688189#M209014</link>
      <description>&lt;P&gt;Wow, this is SUPER!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the 's' in front of '/' used for?&amp;nbsp; And what is '-1' for?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2020 13:28:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-Master-Names-in-the-text/m-p/688189#M209014</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2020-10-01T13:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Remove 'Master_Names' in the text?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-Master-Names-in-the-text/m-p/688192#M209017</link>
      <description>What is the 's' in front of '/' used for? &lt;BR /&gt;s stands for substitute or replace .&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; And what is '-1' for?&lt;BR /&gt;-1 means replace as many times as it could be .</description>
      <pubDate>Thu, 01 Oct 2020 13:36:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-Master-Names-in-the-text/m-p/688192#M209017</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-10-01T13:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: Remove 'Master_Names' in the text?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-Master-Names-in-the-text/m-p/688194#M209019</link>
      <description>Thanks much!</description>
      <pubDate>Thu, 01 Oct 2020 13:40:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-Master-Names-in-the-text/m-p/688194#M209019</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2020-10-01T13:40:08Z</dc:date>
    </item>
  </channel>
</rss>

