<?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: Trouble Shortening a Character String in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749505#M235533</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/351316"&gt;@GreyJoy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;At my office SAS datasets are updated and made available at 5:00 am every morning. Each project has this dataset but this is the only one...so far that is giving me this problem. Before I take it to IT and the Data Managers I want to see if there is something I am missing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you will see in the dataset I provided I am concatenating 3 variables into one to provided the necessary text that will fit into a Label statement. The problem is that the Label ends up looking like...&lt;/P&gt;&lt;P&gt;"THIS IS THE LABLE&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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; " - and I can not get rid of all this blank space. I have tried trim(), Cat, Cats, Catt, Catx, Compress, Substr(Zfieldnm,1,Length(zfieldnm). If anyone can take a look at the file and tell me how you can correctly manipulate the string I would be grateful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;catx("","F",zcrfnb,zfieldnb,'="',zfieldnm,'"')
catx("","F",zcrfnb,zfieldnb,'="',trim(zfieldnm),'"')
"F"||zcrfnb||zfieldnb||'="'||trim(zfieldnm)||'"'
catx("","F",zcrfnb,zfieldnb,'="',substr(zfieldnm,1,length(zfieldnm)),'"')&lt;/CODE&gt;&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;UPDATE: Compress() does the job at removing the blank spaces at the end but I still need to keep the blanks between the words in the Label&lt;/P&gt;</description>
    <pubDate>Tue, 22 Jun 2021 12:41:53 GMT</pubDate>
    <dc:creator>GreyJoy</dc:creator>
    <dc:date>2021-06-22T12:41:53Z</dc:date>
    <item>
      <title>Trouble Shortening a Character String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749475#M235514</link>
      <description>&lt;P&gt;At my office SAS datasets are updated and made available at 5:00 am every morning. Each project has this dataset but this is the only one...so far that is giving me this problem. Before I take it to IT and the Data Managers I want to see if there is something I am missing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you will see in the dataset I provided I am concatenating 3 variables into one to provided the necessary text that will fit into a Label statement. The problem is that the Label ends up looking like...&lt;/P&gt;&lt;P&gt;"THIS IS THE LABLE&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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; " - and I can not get rid of all this blank space. I have tried trim(), Cat, Cats, Catt, Catx, Compress, Substr(Zfieldnm,1,Length(zfieldnm). If anyone can take a look at the file and tell me how you can correctly manipulate the string I would be grateful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;catx("","F",zcrfnb,zfieldnb,'="',zfieldnm,'"')
catx("","F",zcrfnb,zfieldnb,'="',trim(zfieldnm),'"')
"F"||zcrfnb||zfieldnb||'="'||trim(zfieldnm)||'"'
catx("","F",zcrfnb,zfieldnb,'="',substr(zfieldnm,1,length(zfieldnm)),'"')&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Jun 2021 11:35:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749475#M235514</guid>
      <dc:creator>GreyJoy</dc:creator>
      <dc:date>2021-06-22T11:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Shortening a Character String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749477#M235515</link>
      <description>&lt;P&gt;Please post the code you tried.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 11:01:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749477#M235515</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-06-22T11:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Shortening a Character String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749483#M235518</link>
      <description>catx("","F",zcrfnb,zfieldnb,'="',zfieldnm,'"')&lt;BR /&gt;catx("","F",zcrfnb,zfieldnb,'="',trim(zfieldnm),'"')&lt;BR /&gt;"F"||zcrfnb||zfieldnb||'="'||trim(zfieldnm)||'"'&lt;BR /&gt;catx("","F",zcrfnb,zfieldnb,'="',substr(zfieldnm,1,length(zfieldnm)),'"')&lt;BR /&gt;I could keep going with all the different iteration and combinations for what i have done. Just substitute catx with the other cat function or compress.</description>
      <pubDate>Tue, 22 Jun 2021 11:34:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749483#M235518</guid>
      <dc:creator>GreyJoy</dc:creator>
      <dc:date>2021-06-22T11:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Shortening a Character String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749486#M235521</link>
      <description>&lt;P&gt;Since I have no idea what your data looks like, I had to make up some:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
zcrfnb = "AAA    ";
zfieldnb = "BBB    ";
zfieldnm = "XXX   ";
want = catx("","F",zcrfnb,zfieldnb,'="',zfieldnm,'"');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please tell us what you expect instead of&lt;/P&gt;
&lt;PRE&gt;F AAA BBB =" XXX "&lt;/PRE&gt;
&lt;P&gt;or provide us with some real data of yours.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 11:41:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749486#M235521</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-06-22T11:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Shortening a Character String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749487#M235522</link>
      <description>&lt;P&gt;Take a VERY CLOSE look at your data. It might be that the trimming does not work because you have some non-blank, but undisplayable character at the end of your variable.&lt;/P&gt;
&lt;P&gt;So, if your variable was defined as $100, do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;target = put(source,$hex200.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(use double the defined length in the format)&lt;/P&gt;
&lt;P&gt;And then inspect the hex string. Anything else but "20"x will disturb the automatic trimming of CATX and similar functions.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 11:46:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749487#M235522</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-06-22T11:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Shortening a Character String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749502#M235530</link>
      <description>&lt;P&gt;Please re-read my post. I make clear mention of the data I have provided and it is present in the downloadable zip file. You will find a SAS dataset named labels.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 12:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749502#M235530</guid>
      <dc:creator>GreyJoy</dc:creator>
      <dc:date>2021-06-22T12:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Shortening a Character String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749505#M235533</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/351316"&gt;@GreyJoy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;At my office SAS datasets are updated and made available at 5:00 am every morning. Each project has this dataset but this is the only one...so far that is giving me this problem. Before I take it to IT and the Data Managers I want to see if there is something I am missing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you will see in the dataset I provided I am concatenating 3 variables into one to provided the necessary text that will fit into a Label statement. The problem is that the Label ends up looking like...&lt;/P&gt;&lt;P&gt;"THIS IS THE LABLE&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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; " - and I can not get rid of all this blank space. I have tried trim(), Cat, Cats, Catt, Catx, Compress, Substr(Zfieldnm,1,Length(zfieldnm). If anyone can take a look at the file and tell me how you can correctly manipulate the string I would be grateful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;catx("","F",zcrfnb,zfieldnb,'="',zfieldnm,'"')
catx("","F",zcrfnb,zfieldnb,'="',trim(zfieldnm),'"')
"F"||zcrfnb||zfieldnb||'="'||trim(zfieldnm)||'"'
catx("","F",zcrfnb,zfieldnb,'="',substr(zfieldnm,1,length(zfieldnm)),'"')&lt;/CODE&gt;&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;UPDATE: Compress() does the job at removing the blank spaces at the end but I still need to keep the blanks between the words in the Label&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 12:41:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749505#M235533</guid>
      <dc:creator>GreyJoy</dc:creator>
      <dc:date>2021-06-22T12:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Shortening a Character String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749513#M235536</link>
      <description>&lt;P&gt;I downloaded your dataset to my myfolders library, and ran this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
set myfold.labels (keep=zcrfnb zfieldnb zfieldnm);
length want $300;
want = cats("F",zcrfnb,zfieldnb,'="',substr(zfieldnm,1,256),'"');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that you need the SUBSTR because the maximum length of a SAS variable label is 256.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 12:57:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749513#M235536</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-06-22T12:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Shortening a Character String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749527#M235548</link>
      <description>If you look at your 5th observation, you will see that there is an abundance of space between the last character and the closing quotation mark which is my problem. something is causing all these functions that remove spaces to not work.&lt;BR /&gt;If I copy and past the string from sas into the test box here... I get this below.&lt;BR /&gt;&lt;BR /&gt;"F101Q08=""Received botulinum toxin in past 3 months&lt;BR /&gt;"""</description>
      <pubDate>Tue, 22 Jun 2021 13:35:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749527#M235548</guid>
      <dc:creator>GreyJoy</dc:creator>
      <dc:date>2021-06-22T13:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Shortening a Character String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749543#M235559</link>
      <description>&lt;P&gt;The incriminated string is in fact in the 10th observation, and the blanks are caused by special characters:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data check;
set myfold.labels (keep=zfieldnm);
checkvar = put(zfieldnm,$hex100.);
run;

proc print data=check (obs=10 firstobs=10);
var checkvar;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;10	526563656976656420626F74756C696E756D20746F78696E20696E20706173742033206D6F6E7468730D0A20202020202020
&lt;/PRE&gt;
&lt;P&gt;This sequence corresponds to the end of the string:&lt;/P&gt;
&lt;PRE&gt;730D0A20&lt;/PRE&gt;
&lt;P&gt;0D0A is the Windows CRLF. You need to clean your data of such characters.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 13:54:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749543#M235559</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-06-22T13:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Shortening a Character String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749567#M235574</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/351316"&gt;@GreyJoy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;catx("","F",zcrfnb,zfieldnb,'="',zfieldnm,'"')&lt;BR /&gt;catx("","F",zcrfnb,zfieldnb,'="',trim(zfieldnm),'"')&lt;BR /&gt;"F"||zcrfnb||zfieldnb||'="'||trim(zfieldnm)||'"'&lt;BR /&gt;catx("","F",zcrfnb,zfieldnb,'="',substr(zfieldnm,1,length(zfieldnm)),'"')&lt;BR /&gt;I could keep going with all the different iteration and combinations for what i have done. Just substitute catx with the other cat function or compress.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Isn't really working code or a complete statement. There is no assignment to a variable or a semicolon to end any statement.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 14:37:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749567#M235574</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-22T14:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Shortening a Character String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749634#M235616</link>
      <description>Thank you but, I know the problem. The solution is what I am after.</description>
      <pubDate>Tue, 22 Jun 2021 16:53:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749634#M235616</guid>
      <dc:creator>GreyJoy</dc:creator>
      <dc:date>2021-06-22T16:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Shortening a Character String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749636#M235618</link>
      <description>&lt;P&gt;UPDATE 2: Figured it out!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;trim(compress(zfieldnm,,'kw'));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The compress( , , 'kw') works by (k) keeping the characters in the string, while (w) specifies only the printable characters. This removes the special unseen characters that cause Trim to not work. Trim then removes the trailing blanks leaving me with the Label name without unnecessary spaces.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 16:57:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749636#M235618</guid>
      <dc:creator>GreyJoy</dc:creator>
      <dc:date>2021-06-22T16:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Shortening a Character String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749637#M235619</link>
      <description>&lt;P&gt;COMPRESS the hex 0D0A out of the string.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;zfieldnm = compress(zfieldnm,'0d0a'x);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Jun 2021 16:58:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749637#M235619</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-06-22T16:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Shortening a Character String</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749654#M235629</link>
      <description>&lt;P&gt;So that is just removing these characters (at least with encoding=wlatin1).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F
7F
81
8D
8F
90
9D
AD
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It leaves many other potentially spurious characters including the common one 'A0'x that many microsoft applications treat as a non-breaking space.&lt;/P&gt;
&lt;P&gt;Also not clear how it will work with encoding=utf-8&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 17:46:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trouble-Shortening-a-Character-String/m-p/749654#M235629</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-22T17:46:11Z</dc:date>
    </item>
  </channel>
</rss>

