<?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: adding space in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725874#M225546</link>
    <description>Ah, i didn't give enough information. It's not just this number, there are a bunch of numbers, all having the same format. I want to change them all.</description>
    <pubDate>Fri, 12 Mar 2021 18:58:52 GMT</pubDate>
    <dc:creator>geneshackman</dc:creator>
    <dc:date>2021-03-12T18:58:52Z</dc:date>
    <item>
      <title>adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725865#M225541</link>
      <description>&lt;P&gt;Hi all. Hopefully an easy question, for a Friday afternoon. A data set I read in has strings of numbers that look like this, this is one column in text format.&lt;/P&gt;
&lt;P&gt;31.8 (29.7-33.9)&lt;/P&gt;
&lt;P&gt;This is, for example, a rate and the confidence interval. i want to add a space before and after the dash, to make it look like this&lt;/P&gt;
&lt;P&gt;31.8 (29.7 - 33.9)&lt;/P&gt;
&lt;P&gt;Is this easy to do? Say the variable is "rate_ci".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 18:36:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725865#M225541</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2021-03-12T18:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725868#M225543</link>
      <description>&lt;P&gt;Use the Tranwrd Function&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   n  = "31.8 (29.7-33.9)";
   nn = tranwrd(n, "-", " - ");
   put n = / nn =;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;n=31.8 (29.7-33.9)
nn=31.8 (29.7 - 33.9)
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 18:47:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725868#M225543</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-03-12T18:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725869#M225544</link>
      <description>Yes it's easy. You could for replace the '-' with ' - '. There are several ways to do that. You can use sas functions or if you prefer you can use regular expressions. One example is in the thread &lt;A href="https://communities.sas.com/t5/SAS-Programming/Find-And-Replace-within-a-string/td-p/45104" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Find-And-Replace-within-a-string/td-p/45104&lt;/A&gt;.&lt;BR /&gt;Best regards, Jos</description>
      <pubDate>Fri, 12 Mar 2021 18:47:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725869#M225544</guid>
      <dc:creator>JosvanderVelden</dc:creator>
      <dc:date>2021-03-12T18:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725874#M225546</link>
      <description>Ah, i didn't give enough information. It's not just this number, there are a bunch of numbers, all having the same format. I want to change them all.</description>
      <pubDate>Fri, 12 Mar 2021 18:58:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725874#M225546</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2021-03-12T18:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725875#M225547</link>
      <description>Ah, sorry, i didn't give enough information. It's not just this number, there are a bunch of numbers, all having the same format. I want to change them all.</description>
      <pubDate>Fri, 12 Mar 2021 18:59:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725875#M225547</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2021-03-12T18:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725877#M225548</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; What code have you tried? Is there ONLY 1 dash or hyphen in the character string. Is the length of the variable big enough to add 2 characters to the value? Here's one possibility but it will only work if there is exactly 1 dash in the value:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1615575680757.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/55889i4ADBC8B8C8FF5172/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1615575680757.png" alt="Cynthia_sas_0-1615575680757.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 19:01:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725877#M225548</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-03-12T19:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725879#M225549</link>
      <description>Hi. Sorry to say I can't follow the example in the thread. How would I use a sas function? Thanks.</description>
      <pubDate>Fri, 12 Mar 2021 19:03:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725879#M225549</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2021-03-12T19:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725880#M225550</link>
      <description>&lt;P&gt;Please show a more representative example of your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31988"&gt;@geneshackman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Ah, sorry, i didn't give enough information. It's not just this number, there are a bunch of numbers, all having the same format. I want to change them all.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 19:05:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725880#M225550</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-12T19:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725893#M225555</link>
      <description>Group	Category		rate		low		high		rate_ci&lt;BR /&gt;Gender	Male		31.4		28.5		34.4		31.4 (28.5-34.4)&lt;BR /&gt;Gender	Female		31.4		29.1		33.7		31.4 (29.1-33.7)&lt;BR /&gt;Gender	Female		31.5		24.4		38.6		31.5 (24.4-38.6)&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Mar 2021 19:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725893#M225555</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2021-03-12T19:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725894#M225556</link>
      <description>Group	Category		      rate		low		high		rate_ci&lt;BR /&gt;Gender	Male			31.4		28.5		34.4		31.4 (28.5-34.4)&lt;BR /&gt;Gender	Female			31.4		29.1		33.7		31.4 (29.1-33.7)&lt;BR /&gt;Gender	Female			31.5		24.4		38.6		31.5 (24.4-38.6)&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Mar 2021 19:28:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725894#M225556</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2021-03-12T19:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725896#M225557</link>
      <description>sorry, i can't seem to get it to show up with the columns lined up.</description>
      <pubDate>Fri, 12 Mar 2021 19:30:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725896#M225557</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2021-03-12T19:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725903#M225562</link>
      <description>How did you generate this table? Did you use a macro or data step? I'm guessing going back and fixing the code that generated this table is the right place to fix the issue and would be as simple as adding spaces in the CATX function most likely.</description>
      <pubDate>Fri, 12 Mar 2021 19:58:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725903#M225562</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-12T19:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725904#M225563</link>
      <description>Use the code block to ensure your data shows up as needed or ideally create a data step as noted here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;</description>
      <pubDate>Fri, 12 Mar 2021 19:59:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725904#M225563</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-12T19:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725905#M225564</link>
      <description>I'm reading in a data set someone else created.</description>
      <pubDate>Fri, 12 Mar 2021 20:05:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725905#M225564</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2021-03-12T20:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725906#M225565</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31988"&gt;@geneshackman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Group Category rate low high rate_ci&lt;BR /&gt;Gender Male 31.4 28.5 34.4 31.4 (28.5-34.4)&lt;BR /&gt;Gender Female 31.4 29.1 33.7 31.4 (29.1-33.7)&lt;BR /&gt;Gender Female 31.5 24.4 38.6 31.5 (24.4-38.6)&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Let's assume you are trying to show us what the dataset HAVE looks like.&amp;nbsp; And that the last column in your listing is the variable name RATE_CI.&amp;nbsp; So to create a new dataset named WANT with the corrected version of RATE_CI run code like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  rate_ci = tranwrd(rate_ci,'-',' - ');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Check the results and make sure that adding the two extra space characters didn't cause it to run out of room to store the full string.&amp;nbsp; That is make sure the right parenthesis haven't disappeared in the new dataset.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 20:06:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725906#M225565</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-12T20:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725972#M225569</link>
      <description>Thanks!</description>
      <pubDate>Fri, 12 Mar 2021 20:17:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725972#M225569</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2021-03-12T20:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: adding space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725973#M225570</link>
      <description>Thanks very much! This was what I wanted.</description>
      <pubDate>Fri, 12 Mar 2021 20:18:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adding-space/m-p/725973#M225570</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2021-03-12T20:18:39Z</dc:date>
    </item>
  </channel>
</rss>

