<?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: Using PRXPARSE to find hyphen in string and insert a space in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-PRXPARSE-to-find-hyphen-in-string-and-insert-a-space/m-p/856478#M338415</link>
    <description>&lt;P&gt;Yes, it does thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jan 2023 17:43:22 GMT</pubDate>
    <dc:creator>smackerz1988</dc:creator>
    <dc:date>2023-01-31T17:43:22Z</dc:date>
    <item>
      <title>Using PRXPARSE to find hyphen in string and insert a space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-PRXPARSE-to-find-hyphen-in-string-and-insert-a-space/m-p/856473#M338411</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I basically have two values within a column that I need to add a space after a hyphen. Would a combination of find or regex expressions work here?.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input  SUBJID $ INVNAM :$30.; 
infile datalines dlm = '|';
datalines;
1001|Raman
1002|Rodgers
1003|Ekanayake-Bohlig
1004|Renczynska-Matysko
;
run;


data want;
input  SUBJID $ INVNAM :$30.; 
infile datalines dlm = '|';
datalines;
1001|Raman
1002|Rodgers
1003|Ekanayake- Bohlig
1004|Renczynska- Matysko
;
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>Tue, 31 Jan 2023 14:46:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-PRXPARSE-to-find-hyphen-in-string-and-insert-a-space/m-p/856473#M338411</guid>
      <dc:creator>smackerz1988</dc:creator>
      <dc:date>2023-01-31T14:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using PRXPARSE to find hyphen in string and insert a space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-PRXPARSE-to-find-hyphen-in-string-and-insert-a-space/m-p/856474#M338412</link>
      <description>&lt;DIV class="xis-refDictEntry"&gt;
&lt;DIV class="xis-syntax"&gt;
&lt;DIV class="xis-syntaxSimple"&gt;
&lt;DIV class="xis-syntaxLevel"&gt;&lt;SPAN class="xis-keyword"&gt;&lt;FONT&gt;TRANWRD&lt;/FONT&gt;&lt;/SPAN&gt;(&lt;SPAN class="xis-userSuppliedSyntaxValue"&gt;&lt;A title="Description of syntax: source" href="http://127.0.0.1:62799/help/lefunctionsref.hlp/p0pgemqcslm9uen1tvr5gcrusgrw.htm#p16tvph7qxtqurn1r4yzskojkga6" target="_blank"&gt;source&lt;/A&gt;&lt;/SPAN&gt;, &lt;SPAN class="xis-userSuppliedSyntaxValue"&gt;&lt;A title="Description of syntax: target" href="http://127.0.0.1:62799/help/lefunctionsref.hlp/p0pgemqcslm9uen1tvr5gcrusgrw.htm#p0ld5xm879jv9in1n3qq67iak5cn" target="_blank"&gt;target&lt;/A&gt;&lt;/SPAN&gt;, &lt;SPAN class="xis-userSuppliedSyntaxValue"&gt;&lt;A title="Description of syntax: replacement" href="http://127.0.0.1:62799/help/lefunctionsref.hlp/p0pgemqcslm9uen1tvr5gcrusgrw.htm#n1jxmzwce72a4en1dd8ul63mtuw0" target="_blank"&gt;replacement&lt;/A&gt;&lt;/SPAN&gt;)&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="xis-syntaxDescription"&gt;
&lt;DIV class="xis-requiredArgGroup"&gt;
&lt;H3 id="p10s3759a7ezutn1haga86poou6d" class="xis-title"&gt;Required Arguments&lt;/H3&gt;
&lt;DIV id="p16tvph7qxtqurn1r4yzskojkga6" class="xis-argDescriptionPair"&gt;
&lt;H4 class="xis-argument"&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;source&lt;/SPAN&gt;&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;specifies a character constant, variable, or expression that you want to translate.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="p0ld5xm879jv9in1n3qq67iak5cn" class="xis-argDescriptionPair"&gt;
&lt;H4 class="xis-argument"&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;target&lt;/SPAN&gt;&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;specifies a character constant, variable, or expression that is searched for in &lt;SPAN class="xis-userSuppliedValue"&gt;source&lt;/SPAN&gt;.&lt;/P&gt;
&lt;TABLE class="xis-summary"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="xis-requirement"&gt;Requirement&lt;/TD&gt;
&lt;TD class="xis-summaryText"&gt;The length for &lt;SPAN class="xis-userSuppliedValue"&gt;target&lt;/SPAN&gt; must be greater than zero.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="n1jxmzwce72a4en1dd8ul63mtuw0" class="xis-argDescriptionPair"&gt;
&lt;H4 class="xis-argument"&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;replacement&lt;/SPAN&gt;&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;specifies a character constant, variable, or expression that replaces &lt;SPAN class="xis-userSuppliedValue"&gt;target&lt;/SPAN&gt;. When the replacement string has a length of zero, &lt;FONT&gt;TRANWRD&lt;/FONT&gt; uses a single blank instead.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 31 Jan 2023 14:51:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-PRXPARSE-to-find-hyphen-in-string-and-insert-a-space/m-p/856474#M338412</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2023-01-31T14:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using PRXPARSE to find hyphen in string and insert a space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-PRXPARSE-to-find-hyphen-in-string-and-insert-a-space/m-p/856475#M338413</link>
      <description>&lt;P&gt;But I want to add a space not replace the hyphen with a space&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 14:52:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-PRXPARSE-to-find-hyphen-in-string-and-insert-a-space/m-p/856475#M338413</guid>
      <dc:creator>smackerz1988</dc:creator>
      <dc:date>2023-01-31T14:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using PRXPARSE to find hyphen in string and insert a space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-PRXPARSE-to-find-hyphen-in-string-and-insert-a-space/m-p/856477#M338414</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/430963"&gt;@smackerz1988&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can replace the hyphen with a hyphen followed by a space, like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;tranwrd(invnam, "-", "- ")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;A regex expression is unnecessary in this case, but the code would look like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;prxchange('s/-/- /', 1, invnam)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you had more complex requirements, such as add a space only if the hyphen is after the first word or only if the hyphen is not at the end of the string, a regex expression would be more appropriate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope that clarifies what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__&lt;/a&gt;&amp;nbsp;meant.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Joshua&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 15:10:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-PRXPARSE-to-find-hyphen-in-string-and-insert-a-space/m-p/856477#M338414</guid>
      <dc:creator>mtnbikerjoshua</dc:creator>
      <dc:date>2023-01-31T15:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using PRXPARSE to find hyphen in string and insert a space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-PRXPARSE-to-find-hyphen-in-string-and-insert-a-space/m-p/856478#M338415</link>
      <description>&lt;P&gt;Yes, it does thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 17:43:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-PRXPARSE-to-find-hyphen-in-string-and-insert-a-space/m-p/856478#M338415</guid>
      <dc:creator>smackerz1988</dc:creator>
      <dc:date>2023-01-31T17:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using PRXPARSE to find hyphen in string and insert a space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-PRXPARSE-to-find-hyphen-in-string-and-insert-a-space/m-p/856479#M338416</link>
      <description>You're welcome! Also, by the way, thank you for posting example data. &lt;BR /&gt;That always makes it much easier to answer a question.</description>
      <pubDate>Tue, 31 Jan 2023 15:15:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-PRXPARSE-to-find-hyphen-in-string-and-insert-a-space/m-p/856479#M338416</guid>
      <dc:creator>mtnbikerjoshua</dc:creator>
      <dc:date>2023-01-31T15:15:30Z</dc:date>
    </item>
  </channel>
</rss>

