<?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: Replace a double hyphen (“--”) with an EN DASH (&amp;quot;–&amp;quot;) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971886#M377411</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I am not sure you'll ever see the change in the data viewer in EG. However, based on this example &lt;A href="https://documentation.sas.com/doc/en/statug/15.2/statug_kaplan_sect045.htm" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/statug/15.2/statug_kaplan_sect045.htm&lt;/A&gt; in the documentation about how to get a large dash in PROC LIFETEST, I used the ODS ESCAPECHAR string &lt;SPAN&gt;(*ESC*){Unicode '2014'x}&amp;nbsp;&lt;/SPAN&gt;that they show and the results seemed to work for me in ODS output. Basically, I changed your code to use the ODS ESCAPECHAR string in the TRANWRD function and then used PROC PRINT to send the output to either the default destination or ODS PDF or ODS RTF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just pointing out that is an EM dash. Unicode 2013 is the EN dash.&lt;/P&gt;</description>
    <pubDate>Thu, 31 Jul 2025 19:59:35 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2025-07-31T19:59:35Z</dc:date>
    <item>
      <title>Replace a double hyphen (“--”) with an EN DASH ("–")</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971831#M377401</link>
      <description>&lt;P&gt;Hello, I’d like to know if anyone knows how I can replace a double hyphen (“--”) with an EN DASH ("–"). For reference, in microsoft word, this character can be typed using Alt + 0150.&lt;BR /&gt;&lt;BR /&gt;Please, see the example below of what I’m trying to do. I can not use a simple hyphen ("-") as a solution, this restriction was imposed.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data have;&lt;BR /&gt;length region $50;&lt;BR /&gt;input region $char50.;&lt;BR /&gt;datalines;&lt;BR /&gt;Baden--Wurttemberg&lt;BR /&gt;Saxony--Anhalt&lt;BR /&gt;North Rhine--Westphalia&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data want;&lt;BR /&gt;set have;&lt;/P&gt;&lt;P&gt;region_en_dash = tranwrd (region, "--", "EN_DASH");&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2025 15:58:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971831#M377401</guid>
      <dc:creator>MFraga</dc:creator>
      <dc:date>2025-07-31T15:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a double hyphen (“--”) with an EN DASH ("–")</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971832#M377402</link>
      <description>&lt;P&gt;En-dash is hex 96 (see &lt;A href="https://www.ascii-code.com/CP1250" target="_blank"&gt;https://www.ascii-code.com/CP1250&lt;/A&gt;) ... so you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;region_en_dash = tranwrd (region, "--", "96"x);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2025 16:06:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971832#M377402</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-07-31T16:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a double hyphen (“--”) with an EN DASH ("–")</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971833#M377403</link>
      <description>&lt;P&gt;See if this meets your need:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
set have;
region_en_dash = tranwrd (region, "--", byte(150));

run;

&lt;/PRE&gt;
&lt;P&gt;The BYTE function returns characters from ASCII or EBCDIC coding, depending on OS and emulates the characters on the keypad mentioned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a more general approach you may need to look at UNICODE characters.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2025 16:05:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971833#M377403</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2025-07-31T16:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a double hyphen (“--”) with an EN DASH ("–")</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971846#M377404</link>
      <description>&lt;P&gt;Thanks for your help.&amp;nbsp;Unfortunately, none of the solutions worked, the character simply disappears in my SAS interface (in other words, the words get stuck together without the en dash or any space in between). How can I understand why this is happening and how to fix it?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2025 17:44:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971846#M377404</guid>
      <dc:creator>MFraga</dc:creator>
      <dc:date>2025-07-31T17:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a double hyphen (“--”) with an EN DASH ("–")</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971849#M377405</link>
      <description>&lt;P&gt;Saying "&lt;SPAN&gt;none of the solutions worked" gives us no information to help figure out what the problem is. We need at least these items of information:&amp;nbsp;&lt;/SPAN&gt;What is your SAS interface? Show us the code you are using. Show us a screen capture of the result where the en dash has disappeared. What language do you have SAS set to?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2025 18:29:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971849#M377405</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-07-31T18:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a double hyphen (“--”) with an EN DASH ("–")</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971850#M377406</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236673"&gt;@MFraga&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for your help.&amp;nbsp;Unfortunately, none of the solutions worked, the character simply disappears in my SAS interface (in other words, the words get stuck together without the en dash or any space in between). How can I understand why this is happening and how to fix it?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What encoding are you using?&lt;/P&gt;
&lt;P&gt;Check the value of the system option ENCODING.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put %sysfunc(getoption(encoding));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You might try using KCVT() so that you can try making the en-dash character (if it exits) in your current encoding.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In UTF-8 encoding and EN DASH is this character.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;'E28093'x
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;region_en_dash = tranwrd(region,'--',kcvt('E28093'x,'utf-8',getoption('encoding')));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Jul 2025 18:32:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971850#M377406</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-07-31T18:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a double hyphen (“--”) with an EN DASH ("–")</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971861#M377407</link>
      <description>&lt;P&gt;SAS Entreprise Guide&lt;BR /&gt;The code I am using:&lt;/P&gt;&lt;P&gt;data want_hex;&lt;BR /&gt;set have;&lt;/P&gt;&lt;P&gt;region_en_dash = tranwrd (region, "--", "96"x);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data want_byte;&lt;BR /&gt;set have;&lt;/P&gt;&lt;P&gt;region_en_dash = tranwrd (region, "--", byte(150));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data want_KCVT;&lt;BR /&gt;set have;&lt;BR /&gt;en_dash = byte(150);&lt;BR /&gt;region_en_dash = tranwrd(region,'--',kcvt('E28093'x,'utf-8',getoption('encoding')));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Encoding: LATIN9&lt;/P&gt;&lt;P&gt;Print screen attached showing the results.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Byte.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108707iCB15BE8BBDE145FE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Byte.png" alt="Byte.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hex.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108708i081DFB6296A71991/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hex.png" alt="Hex.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kcvt.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108709i715888BD2DC0F991/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kcvt.png" alt="kcvt.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2025 18:50:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971861#M377407</guid>
      <dc:creator>MFraga</dc:creator>
      <dc:date>2025-07-31T18:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a double hyphen (“--”) with an EN DASH ("–")</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971864#M377408</link>
      <description>&lt;P&gt;That character does not exist in the LATIN9 encoding.&lt;/P&gt;
&lt;PRE&gt;25   data test;
26     length wlatin1 latin9 $1 utf8 $4 ;
27     wlatin1='96'x;
28     utf8 = kcvt(wlatin1,'wlatin1','utf-8');
29     latin9 = kcvt(utf8,'utf-8','latin9');
30     put (_all_) (=$hex.);
31   run;

wlatin1=96 latin9=1A utf8=E2809320
&lt;/PRE&gt;
&lt;P&gt;The character '1A'x is what KCVT() returns for something that it cannot transcode.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2025 18:53:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971864#M377408</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-07-31T18:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a double hyphen (“--”) with an EN DASH ("–")</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971871#M377409</link>
      <description>&lt;P&gt;So what would be the way to work around this limitation? Changing the SAS encoding?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2025 19:15:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971871#M377409</guid>
      <dc:creator>MFraga</dc:creator>
      <dc:date>2025-07-31T19:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a double hyphen (“--”) with an EN DASH ("–")</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971885#M377410</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; I am not sure you'll ever see the change in the data viewer in EG. However, based on this example &lt;A href="https://documentation.sas.com/doc/en/statug/15.2/statug_kaplan_sect045.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/statug/15.2/statug_kaplan_sect045.htm&lt;/A&gt; in the documentation about how to get a large dash in PROC LIFETEST, I used the ODS ESCAPECHAR string &lt;SPAN&gt;(*ESC*){Unicode '2014'x}&amp;nbsp;&lt;/SPAN&gt;that they show and the results seemed to work for me in ODS output. Basically, I changed your code to use the ODS ESCAPECHAR string in the TRANWRD function and then used PROC PRINT to send the output to either the default destination or ODS PDF or ODS RTF.&lt;/P&gt;&lt;P&gt;PDF results:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_1-1753991219846.jpeg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108728iEAD61FDDCFC475DB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_1-1753991219846.jpeg" alt="Cynthia_sas_1-1753991219846.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RTF results:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_2-1753991248974.jpeg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108729i1F60A0AC907ECA43/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_2-1753991248974.jpeg" alt="Cynthia_sas_2-1753991248974.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, when I look at the data in the data viewer in SAS Studio, I see the actual ESCAPECHAR string, which will only be rendered in ODS output, not in the data viewer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cynthia&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2025 19:49:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971885#M377410</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2025-07-31T19:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a double hyphen (“--”) with an EN DASH ("–")</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971886#M377411</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I am not sure you'll ever see the change in the data viewer in EG. However, based on this example &lt;A href="https://documentation.sas.com/doc/en/statug/15.2/statug_kaplan_sect045.htm" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/statug/15.2/statug_kaplan_sect045.htm&lt;/A&gt; in the documentation about how to get a large dash in PROC LIFETEST, I used the ODS ESCAPECHAR string &lt;SPAN&gt;(*ESC*){Unicode '2014'x}&amp;nbsp;&lt;/SPAN&gt;that they show and the results seemed to work for me in ODS output. Basically, I changed your code to use the ODS ESCAPECHAR string in the TRANWRD function and then used PROC PRINT to send the output to either the default destination or ODS PDF or ODS RTF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just pointing out that is an EM dash. Unicode 2013 is the EN dash.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2025 19:59:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971886#M377411</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-07-31T19:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Replace a double hyphen (“--”) with an EN DASH ("–")</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971887#M377412</link>
      <description>&lt;P&gt;Thank you all for your help! In fact, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt;&amp;nbsp;, by applying your solution, I’m not able to get the data to display in the SAS interface the way I want. However, when I generate the results for export (which is what really matters to me now), I do get what I need. Thank you, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;, for pointing out the correct code for the EN DASH.&lt;BR /&gt;&lt;BR /&gt;What would be the best way to have the EN DASH display correctly in my SAS interface? Would changing the encoding to UTF-8 be the solution?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2025 20:10:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replace-a-double-hyphen-with-an-EN-DASH-quot-quot/m-p/971887#M377412</guid>
      <dc:creator>MFraga</dc:creator>
      <dc:date>2025-07-31T20:10:39Z</dc:date>
    </item>
  </channel>
</rss>

