<?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: Colum issue with Cat text to string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Colum-issue-with-Cat-text-to-string/m-p/855679#M338145</link>
    <description>&lt;P&gt;It would help if you showed exactly what you expect for the result. "Length 25" is sort of indeterminate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are using things like this in the CATT function to add spaces then&amp;nbsp; you don't want the CATT function. The second T sort of means remove the trailing spaces.&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;"  /  " &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Try using the &lt;STRONG&gt;CAT&lt;/STRONG&gt; function instead of CATT.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jan 2023 03:46:39 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-01-26T03:46:39Z</dc:date>
    <item>
      <title>Colum issue with Cat text to string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Colum-issue-with-Cat-text-to-string/m-p/855676#M338144</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I use the below code to concat few date into text.&lt;/P&gt;
&lt;P&gt;It works fine but the column itself is much bigger than it suppose to be even though I put the Length statement.&lt;/P&gt;
&lt;P&gt;The output is:&lt;/P&gt;
&lt;P&gt;T:11:59 /11:59 /11:59&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;. With a lot of blank after&lt;/P&gt;
&lt;P&gt;When I check column attributes, it shows: Length 25, Format$25., Informat $25.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The original clock_time attribute is:&amp;nbsp;Length 8, TIME10.,&amp;nbsp;TIME20.3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please help to make the column width is 25?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data export; 
length time $ 25;
set a; 
time = catt("T: ", put(clock_time,time5.),"  /  " , put(clock_time,time5.),"  /  " , put(clock_time,time5.) );
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 02:49:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Colum-issue-with-Cat-text-to-string/m-p/855676#M338144</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2023-01-26T02:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Colum issue with Cat text to string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Colum-issue-with-Cat-text-to-string/m-p/855679#M338145</link>
      <description>&lt;P&gt;It would help if you showed exactly what you expect for the result. "Length 25" is sort of indeterminate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are using things like this in the CATT function to add spaces then&amp;nbsp; you don't want the CATT function. The second T sort of means remove the trailing spaces.&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;"  /  " &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Try using the &lt;STRONG&gt;CAT&lt;/STRONG&gt; function instead of CATT.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 03:46:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Colum-issue-with-Cat-text-to-string/m-p/855679#M338145</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-01-26T03:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Colum issue with Cat text to string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Colum-issue-with-Cat-text-to-string/m-p/855680#M338146</link>
      <description>&lt;P&gt;You've already defined TIME with a LENGTH of 25 characters and checked that the attributes are correct. Your string "&lt;SPAN&gt;T:11:59 /11:59 /11:59" is 21 characters long so it will be stored in TIME with 4 blank spaces on the end.&amp;nbsp;&lt;/SPAN&gt;Why do you think&amp;nbsp;"column width" is not 25?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 03:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Colum-issue-with-Cat-text-to-string/m-p/855680#M338146</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-01-26T03:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Colum issue with Cat text to string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Colum-issue-with-Cat-text-to-string/m-p/855684#M338148</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2023-01-25_23-47-52.jpg" style="width: 369px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/79820i66812724DB490915/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-01-25_23-47-52.jpg" alt="2023-01-25_23-47-52.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the SAS file has time column look like above with the width quite big. And when I export to excel, the column is wide as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure why.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 04:50:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Colum-issue-with-Cat-text-to-string/m-p/855684#M338148</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2023-01-26T04:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: Colum issue with Cat text to string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Colum-issue-with-Cat-text-to-string/m-p/855772#M338181</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49486"&gt;@hhchenfx&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2023-01-25_23-47-52.jpg" style="width: 369px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/79820i66812724DB490915/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-01-25_23-47-52.jpg" alt="2023-01-25_23-47-52.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the SAS file has time column look like above with the width quite big. And when I export to excel, the column is wide as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure why.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I gave up trying to figure out how Excel will display any given values a long time ago. Random wrapping of values, picking a display width narrow or longer than declared lengths of values, changing actual values (when opening CSV or tab delimited files).&lt;/P&gt;
&lt;P&gt;Again I say, &lt;STRONG&gt;show what you expect for output.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 15:51:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Colum-issue-with-Cat-text-to-string/m-p/855772#M338181</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-01-26T15:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Colum issue with Cat text to string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Colum-issue-with-Cat-text-to-string/m-p/855787#M338183</link>
      <description>&lt;P&gt;The CATT() function with TRIM() the value (remove the TRAILING spaces before concatenating them.&lt;/P&gt;
&lt;P&gt;That is why the spaces after the colon and slashes are removed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you just confused because SAS stores strings a FIXED length?&lt;/P&gt;
&lt;P&gt;If you define TIME as 25 bytes long and the store strings that are only 2+5+3+5+3+5 = 23 characters long then there will be two extra spaces added to pad the length to the full 25 bytes.&lt;/P&gt;
&lt;P&gt;If you switch to CAT() instead of CATT() then the spaces will be include so you will make a string that is 3+5+5+5+5+5=28 bytes long so the last 3 characters of the last copy of the TIME will be lost when you store the 28 bytes into a variable that can only hold 25 bytes.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 16:58:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Colum-issue-with-Cat-text-to-string/m-p/855787#M338183</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-01-26T16:58:53Z</dc:date>
    </item>
  </channel>
</rss>

