<?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: padding blanks on variable values in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/padding-blanks-on-variable-values/m-p/101420#M8943</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Doc@duke,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to padd blank when a variable value is not equal to length of&amp;nbsp; 5. Do you think I can safely assume that length of variable is 5 if i define length of the variable in the beginning of the statement as 5 regardless of the length given by length function. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Apr 2013 20:21:12 GMT</pubDate>
    <dc:creator>learner_sas</dc:creator>
    <dc:date>2013-04-08T20:21:12Z</dc:date>
    <item>
      <title>padding blanks on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/padding-blanks-on-variable-values/m-p/101418#M8941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a character variable which has values of different length . I want to make all of them of same length. I used &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if length(x_var) = 3 then x_new_var = x_var||"&amp;nbsp; ";&lt;/P&gt;&lt;P&gt;else if ....4 then ...;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I but the original length is not changing. I am wondering if any of you can help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 20:09:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/padding-blanks-on-variable-values/m-p/101418#M8941</guid>
      <dc:creator>learner_sas</dc:creator>
      <dc:date>2013-04-08T20:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: padding blanks on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/padding-blanks-on-variable-values/m-p/101419#M8942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ram,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think that this is just a definition problem.&amp;nbsp; All character variables in SAS are fixed length.&amp;nbsp; The LENGTH function measures the number of characters, from the left, to the last non-blank character on the right.&amp;nbsp; Therefore, your x_var and x_new_var would both show as having the same LENGTH when you use that function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doc Muhlbaier&lt;/P&gt;&lt;P&gt;Duke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 20:13:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/padding-blanks-on-variable-values/m-p/101419#M8942</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2013-04-08T20:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: padding blanks on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/padding-blanks-on-variable-values/m-p/101420#M8943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Doc@duke,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to padd blank when a variable value is not equal to length of&amp;nbsp; 5. Do you think I can safely assume that length of variable is 5 if i define length of the variable in the beginning of the statement as 5 regardless of the length given by length function. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 20:21:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/padding-blanks-on-variable-values/m-p/101420#M8943</guid>
      <dc:creator>learner_sas</dc:creator>
      <dc:date>2013-04-08T20:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: padding blanks on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/padding-blanks-on-variable-values/m-p/101421#M8944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To speed up your learning of SAS, think about how you could test this for yourself.&amp;nbsp; For example, you could code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;length a $ 5;&lt;/P&gt;&lt;P&gt;a='ABC';&lt;/P&gt;&lt;P&gt;newvar = a || '*';&lt;/P&gt;&lt;P&gt;put newvar=;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 20:25:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/padding-blanks-on-variable-values/m-p/101421#M8944</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-04-08T20:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: padding blanks on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/padding-blanks-on-variable-values/m-p/101422#M8945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many are very experienced and skilled in programming, But you are the best instructor on the forum!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 20:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/padding-blanks-on-variable-values/m-p/101422#M8945</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-04-08T20:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: padding blanks on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/padding-blanks-on-variable-values/m-p/101423#M8946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Astounding,&lt;/P&gt;&lt;P&gt;I used your dataset but my problem still persists.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;14&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GOPTIONS ACCESSIBLE;&lt;/P&gt;&lt;P&gt;15&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data test;&lt;/P&gt;&lt;P&gt;16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length a $ 5;&lt;/P&gt;&lt;P&gt;17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a='ABC';&lt;/P&gt;&lt;P&gt;18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newvar = a || '*';&lt;/P&gt;&lt;P&gt;19&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newvar1 = a||' ';&lt;/P&gt;&lt;P&gt;20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put newvar:'end';&lt;/P&gt;&lt;P&gt;21&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put a :'end';&lt;/P&gt;&lt;P&gt;22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put newvar1:'end' ;&lt;/P&gt;&lt;P&gt;23&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ABC&amp;nbsp; * end&lt;/P&gt;&lt;P&gt;ABC end&lt;/P&gt;&lt;P&gt;ABC end&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when I did put statement why&amp;nbsp; both of the ABC's(a and newvar1) has same length considering i added a blank on newvar1. Is there any way to achieve right padding on newvar1 with one more blank.I re run the process by removing &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;length statement still I had same output.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ram Rimal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2013 20:52:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/padding-blanks-on-variable-values/m-p/101423#M8946</guid>
      <dc:creator>learner_sas</dc:creator>
      <dc:date>2013-04-09T20:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: padding blanks on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/padding-blanks-on-variable-values/m-p/101424#M8947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ram,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You did actually add a blank.&amp;nbsp; You could see this by trying:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;newvar2 = newvar1 || '*';&lt;/P&gt;&lt;P&gt;put newvar;&lt;/P&gt;&lt;P&gt;put newvar2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that the PUT statement doesn't write out all the blanks.&amp;nbsp; By default, it writes all the nonblank characters, and then leaves a single blank following.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is your final objective here?&amp;nbsp; If you would like to write a report that contains blanks, it's easy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;put @1 a&amp;nbsp; @7 'end';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When all is said and done, what would you like to achieve?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2013 21:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/padding-blanks-on-variable-values/m-p/101424#M8947</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-04-09T21:05:00Z</dc:date>
    </item>
  </channel>
</rss>

