<?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 extra comma in different string location? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/792029#M253771</link>
    <description>Neither of them.</description>
    <pubDate>Tue, 25 Jan 2022 00:36:43 GMT</pubDate>
    <dc:creator>ybz12003</dc:creator>
    <dc:date>2022-01-25T00:36:43Z</dc:date>
    <item>
      <title>Remove extra comma in different string location?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/788960#M252383</link>
      <description>&lt;P&gt;Hello experts,&lt;/P&gt;
&lt;P&gt;I would like to remove extra comma in different locations of the text.&amp;nbsp; Sometimes, front, back, and in the middle.&amp;nbsp; &amp;nbsp;In addition, there might be a double at the front or in the end.&amp;nbsp; &amp;nbsp;Is there a way to do that?&amp;nbsp; Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
      infile datalines delimiter='#';
  input Comments : $200.  ;
datalines;
	, , FAILURE TO THRIVE #
	CHOLESTASIS, ,  ANEMIA#
	UGESTAGE=33.4 WKS , ROP #
	ASD, , #
	, NON VERBAL, 
;
run;

data want;
      infile datalines delimiter='#';
  input Comments : $200.  ;
datalines;
	FAILURE TO THRIVE #
	CHOLESTASIS, ANEMIA#
	UGESTAGE=33.4 WKS , ROP #
	ASD#
	NON VERBAL 
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Jan 2022 20:41:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/788960#M252383</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2022-01-07T20:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Remove extra comma in different string location?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/788966#M252388</link>
      <description>&lt;P&gt;Always comma-space-comma? Use the &lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/lefunctionsref/p0pgemqcslm9uen1tvr5gcrusgrw.htm" target="_self"&gt;TRANWRD function&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Comma at the end: Use the STRIP() function to remove leading and trailing blanks, then find the last character and remove it using&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;IF SUBSTR(REVERSE(string),1,1)=',' THEN STRING=SUBSTR(STRING,1,LENGTH(STRING)-1);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Comma at the beginning: obvious modification of the code to remove comma at the end&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 21:31:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/788966#M252388</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-07T21:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Remove extra comma in different string location?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/789030#M252425</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
      infile datalines delimiter='#';
  input Comments : $200.  ;
datalines;
	, , FAILURE TO THRIVE #
	CHOLESTASIS, ,  ANEMIA#
	UGESTAGE=33.4 WKS , ROP #
	ASD, , #
	, NON VERBAL, 
;
run;

data want;
 set have;
 temp=prxchange('s/,\s*,/,/',-1,Comments);
 want=prxchange('s/^\s*,\s*|\s*,\s*$//',-1,temp);
 drop temp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 08 Jan 2022 11:53:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/789030#M252425</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-01-08T11:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Remove extra comma in different string location?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/789188#M252493</link>
      <description>Thank you so much!</description>
      <pubDate>Mon, 10 Jan 2022 04:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/789188#M252493</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2022-01-10T04:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Remove extra comma in different string location?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/789226#M252507</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of these days, I need to learn regular expressions. You have quite a mastery of them!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which kind of brings up a question: I am pretty good at parsing strings using built in SAS functions such as SUBSTR() and ANYDIGIT() and dozens of other ones., what is the benefit of regular expressions over and above what SAS provides?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 11:21:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/789226#M252507</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-10T11:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: Remove extra comma in different string location?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/789231#M252510</link>
      <description>In some case, only  regular expressions can get job done, therefore PRX was a must-have skill for sas programmer as much as Hash Table .</description>
      <pubDate>Mon, 10 Jan 2022 12:09:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/789231#M252510</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-01-10T12:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Remove extra comma in different string location?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/789232#M252511</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;, regular expressions are definitely on my list of things to learn, along with 27 bazillion other things (some of them having nothing to do with SAS).&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 12:13:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/789232#M252511</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-10T12:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Remove extra comma in different string location?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/789252#M252529</link>
      <description>7 year ago was my first time seeing PERI.   After 7 year, I still have no clue how to use it.   LOL!!!</description>
      <pubDate>Mon, 10 Jan 2022 13:57:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/789252#M252529</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2022-01-10T13:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Remove extra comma in different string location?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/789445#M252622</link>
      <description>Are you learning R , Python ?</description>
      <pubDate>Tue, 11 Jan 2022 11:48:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/789445#M252622</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-01-11T11:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Remove extra comma in different string location?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/792029#M253771</link>
      <description>Neither of them.</description>
      <pubDate>Tue, 25 Jan 2022 00:36:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-extra-comma-in-different-string-location/m-p/792029#M253771</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2022-01-25T00:36:43Z</dc:date>
    </item>
  </channel>
</rss>

