<?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: Leading blank in strings in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645444#M192944</link>
    <description>&lt;P&gt;Please check the length's of each value of the&amp;nbsp;Municipality variable in test_urb1 vs Id_strip&lt;/P&gt;
&lt;P&gt;using length function.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;len=lengthn(id_strip)&lt;/STRONG&gt; and notice the difference in the lengths. This should give you some idea than deceiving visuals&lt;/P&gt;</description>
    <pubDate>Tue, 05 May 2020 22:43:13 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-05-05T22:43:13Z</dc:date>
    <item>
      <title>Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645443#M192943</link>
      <description>&lt;P&gt;Hi Folks:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to remove the leading indent from a variable. None of trim, trimn, strip and compbl functions work.&lt;/P&gt;
&lt;P&gt;What is not working here? I appreciate your suggestions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="blanks.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39091iA2BE5F6E3C411E72/image-size/large?v=v2&amp;amp;px=999" role="button" title="blanks.png" alt="blanks.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test_urb1; set test_urb;
ID_strip=strip(Municipality);
ID_trim=trim(left(Municipality));
ID_trimn=trimn(left(Municipality));
ID_compbl=compbl(Municipality);
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 22:39:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645443#M192943</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2020-05-05T22:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645444#M192944</link>
      <description>&lt;P&gt;Please check the length's of each value of the&amp;nbsp;Municipality variable in test_urb1 vs Id_strip&lt;/P&gt;
&lt;P&gt;using length function.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;len=lengthn(id_strip)&lt;/STRONG&gt; and notice the difference in the lengths. This should give you some idea than deceiving visuals&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 22:43:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645444#M192944</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-05-05T22:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645446#M192946</link>
      <description>&lt;P&gt;Try displaying the variable with a hex format to see what character are there.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 22:44:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645446#M192946</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-05-05T22:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645448#M192947</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interesting. What shall I do? Take it as a success in using strip function?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NOVINOSIRIN.png" style="width: 431px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39092i9E181631A4BA7954/image-size/large?v=v2&amp;amp;px=999" role="button" title="NOVINOSIRIN.png" alt="NOVINOSIRIN.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 22:48:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645448#M192947</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2020-05-05T22:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645449#M192948</link>
      <description>&lt;P&gt;Maybe the indent is not a result of blanks.&lt;/P&gt;
&lt;P&gt;check the left most character by:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;indent = substr(municipality,1,1);
put indent $hex2.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 May 2020 22:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645449#M192948</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-05-05T22:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645450#M192949</link>
      <description>&lt;P&gt;Use the data step generator to show what values you actually have:&lt;BR /&gt;Instructions 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; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the &amp;lt;&amp;gt; icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warning: if you are using some double-byte character set this may not help.&lt;/P&gt;
&lt;P&gt;Or use the RANK function to see what the first character may be:&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; x = rank(first(municipality));&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;X would be the order in the ASCII (or EBCDIC) character set. If the value is not 32 you do not have a blank. Note that Rank will return the Hex number.&lt;/P&gt;
&lt;P&gt;I'm not sure if this will work but the second string below starts with a null character that can be entered on some systems using Alt plus the digits 255 and if the box works correctly the second X= should show 160 (the hex equiv of 255).&lt;/P&gt;
&lt;PRE&gt;data example;
   string = ' abcdef';
   x = rank(first(string));
   put x=;
   string = '&amp;nbsp;abcdef';
   x = rank(first(string));
   put x=;
run;&lt;/PRE&gt;
&lt;P&gt;The functions you tried would not remove the null as they are not blanks, i.e. ASCII 32.&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 22:53:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645450#M192949</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-05T22:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645451#M192950</link>
      <description>&lt;P&gt;Nope all values being 12 bytes of length concerns me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may try to remove&amp;nbsp;&lt;SPAN&gt;hexadecimal characters and control chars if any using:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;X is&amp;nbsp;hexadecimal characters &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;C is&amp;nbsp;control chars&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;' ' is blank&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;id_strip=strip(compress(Municipality,' ','xc'));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 May 2020 22:55:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645451#M192950</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-05-05T22:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645453#M192951</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you, pls see rank results below. testing your code on my data now.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="balardw.png" style="width: 791px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39093i98BBD02C64E39A16/image-size/large?v=v2&amp;amp;px=999" role="button" title="balardw.png" alt="balardw.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 22:57:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645453#M192951</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2020-05-05T22:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645455#M192953</link>
      <description>Thanks Ballardw, what would 227 indicate?</description>
      <pubDate>Tue, 05 May 2020 23:00:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645455#M192953</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2020-05-05T23:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645456#M192954</link>
      <description>Thanks Shmuel. It returned E3. What would E3 indicate? I have no idea.</description>
      <pubDate>Tue, 05 May 2020 23:02:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645456#M192954</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2020-05-05T23:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645457#M192955</link>
      <description>Variable indent is black. Took no values. I'm confused.</description>
      <pubDate>Tue, 05 May 2020 23:03:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645457#M192955</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2020-05-05T23:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645458#M192956</link>
      <description>&lt;P&gt;You should be able to use Byte(227) as a character to remove with COMPRESS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; compress(municipality,byte(227))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May still need to use COMPBL to remove blanks depending on result.&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 23:05:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645458#M192956</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-05T23:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645460#M192957</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;I got leading blank replaced by weird symbols as shown below.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="balardw2.png" style="width: 616px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39094i7F187B1DC3595C6E/image-size/large?v=v2&amp;amp;px=999" role="button" title="balardw2.png" alt="balardw2.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 23:09:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645460#M192957</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2020-05-05T23:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645461#M192958</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp; Just extract the need if thats ok?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
length 	id_strip $15;
id_strip=substr(municipality,anyalpha(municipality));
check_length=lengthn(id_strip);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 May 2020 23:10:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645461#M192958</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-05-05T23:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645462#M192959</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks Ballardw, what would 227 indicate?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Anything above 127 is font dependent. Typically used for "foreign language" characters from an American English speakers point of view (Hint: what does the A in ASCII stand for?). Or graphic characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For kicks you could run this code:&lt;/P&gt;
&lt;PRE&gt;data _null_;
   file print;
   do x= 32 to 255;
      z= byte(x);
      put x= z=;
   end;
run;&lt;/PRE&gt;
&lt;P&gt;save the result to a text file. Open the file and change the display font to see things change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 23:14:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645462#M192959</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-05T23:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645463#M192960</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.URBANICITY;
  infile datalines dsd truncover;
  input Municipality:$36. urbanicity:COMMA15.;
  format urbanicity COMMA15.;
  label Municipality="Municipality" urbanicity="urbanicity";
datalines;
Seoul 605,569,314
ã€€ã€€ã€€Jongno-gu 23,972,507
ã€€ã€€ã€€Jung-gu 9,974,292
ã€€ã€€ã€€Yongsan-gu 21,870,000
ã€€ã€€ã€€Seongdong-gu 16,804,426
;;;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope I got the guidance right. This is the data I'm dealing with.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 23:14:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645463#M192960</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2020-05-05T23:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645464#M192961</link>
      <description>&lt;P&gt;Repeats of the same 3 characters is making me think that your actual data may be DBCS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And perhaps the KCOMPRESS, KTRIM may be wanted.&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 23:17:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645464#M192961</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-05T23:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645465#M192962</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp; has nailed it. That's the reason, I have nicknamed him the "Cop"&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 23:19:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645465#M192962</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-05-05T23:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645472#M192965</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kcomp.png" style="width: 260px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39095iF6A97E366084B18F/image-size/large?v=v2&amp;amp;px=999" role="button" title="kcomp.png" alt="kcomp.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You hit the nail on the head! kcomp it is. Hurray!&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 23:24:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645472#M192965</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2020-05-05T23:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: Leading blank in strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645473#M192966</link>
      <description>&lt;P&gt;Searching for&amp;nbsp; &amp;nbsp;ã€€&amp;nbsp; &amp;nbsp;brings up&amp;nbsp; &amp;nbsp;ã€€ 文字化け&lt;/P&gt;
&lt;P&gt;So MBCS indeed.&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 23:28:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-blank-in-strings/m-p/645473#M192966</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-05-05T23:28:42Z</dc:date>
    </item>
  </channel>
</rss>

