<?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 Blanks in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Blanks/m-p/354122#M82787</link>
    <description>&lt;P&gt;Hello ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any preference for using "" versus " " to identify blank charecter fields?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;I am trying to assign a value of 'OP' to all the ID's which are blank&lt;/P&gt;&lt;P&gt;so the IF statement can be either of the 2 below?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; INP_OP=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;" "&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; INP_OP=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'OP'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&amp;nbsp; ---1 space&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt; INP_OP=&lt;FONT color="#800080" face="Courier New" size="2"&gt;""&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt; INP_OP=&lt;FONT color="#800080" face="Courier New" size="2"&gt;'OP'&lt;/FONT&gt;; ----no space between quotes&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;INP_OP&amp;nbsp;&amp;nbsp;&amp;nbsp; ID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 101&lt;/P&gt;&lt;P&gt;INP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 102&lt;/P&gt;&lt;P&gt;INP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 103&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 104&lt;/P&gt;&lt;P&gt;INP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 105&lt;/P&gt;&lt;P&gt;INP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 106&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 107&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;108&lt;BR /&gt;INP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 109&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Apr 2017 14:14:11 GMT</pubDate>
    <dc:creator>robertrao</dc:creator>
    <dc:date>2017-04-27T14:14:11Z</dc:date>
    <item>
      <title>Blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Blanks/m-p/354122#M82787</link>
      <description>&lt;P&gt;Hello ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any preference for using "" versus " " to identify blank charecter fields?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;I am trying to assign a value of 'OP' to all the ID's which are blank&lt;/P&gt;&lt;P&gt;so the IF statement can be either of the 2 below?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; INP_OP=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;" "&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; INP_OP=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'OP'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&amp;nbsp; ---1 space&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt; INP_OP=&lt;FONT color="#800080" face="Courier New" size="2"&gt;""&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt; INP_OP=&lt;FONT color="#800080" face="Courier New" size="2"&gt;'OP'&lt;/FONT&gt;; ----no space between quotes&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;INP_OP&amp;nbsp;&amp;nbsp;&amp;nbsp; ID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 101&lt;/P&gt;&lt;P&gt;INP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 102&lt;/P&gt;&lt;P&gt;INP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 103&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 104&lt;/P&gt;&lt;P&gt;INP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 105&lt;/P&gt;&lt;P&gt;INP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 106&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 107&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;108&lt;BR /&gt;INP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 109&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 14:14:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Blanks/m-p/354122#M82787</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2017-04-27T14:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Blanks/m-p/354126#M82789</link>
      <description>&lt;P&gt;For the examples you listed, pick whichever you like.&amp;nbsp; I find it easier to read the code when the blank appears.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Technically, there are other cases where it might make a difference.&amp;nbsp; Within PROC SQL, these produce different results:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;separated by ' '&lt;/P&gt;
&lt;P&gt;separated by ''&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I haven't tested it, but I imagine these could produce different results as well:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if in_op =: ' ' then do;&lt;/P&gt;
&lt;P&gt;if in_op =: '' then do;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 14:28:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Blanks/m-p/354126#M82789</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-04-27T14:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Blanks/m-p/354127#M82790</link>
      <description>&lt;P&gt;Out of curiosity, which one is more accurate? &amp;nbsp;I assume that the second option would be more accurate, but what are you finding in your data?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 14:28:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Blanks/m-p/354127#M82790</guid>
      <dc:creator>thomp7050</dc:creator>
      <dc:date>2017-04-27T14:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: Blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Blanks/m-p/354131#M82791</link>
      <description>&lt;P&gt;Tricky one. &amp;nbsp;Yes, most of the time that would be fine having "" or " ", my preference would be for the "" as that shows a null string, whereas the other looks almost like your expecting to be one space. &amp;nbsp;There are times where spaces are important, strip() versus trim() is one that pops to mind, and asis=on in proc report. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to be fool proof then the simplest method is to use the missing() function rather than the logic, so rather than:&lt;/P&gt;
&lt;PRE&gt;if variable=" " then flag="Y";
&lt;/PRE&gt;
&lt;P&gt;Do:&lt;/P&gt;
&lt;PRE&gt;if missing(variable) then flag="Y";&lt;/PRE&gt;
&lt;P&gt;Of course this is easier if you use numeric flags:&lt;/P&gt;
&lt;PRE&gt;flag=missing(variable);
&lt;/PRE&gt;
&lt;P&gt;Its a bit of two of one and half a dozen of the other though much like the do you use || or the cat functions, in most scenarios cat functions are more readable, is cat(a,b) better then a||b?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 14:30:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Blanks/m-p/354131#M82791</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-27T14:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Blanks/m-p/354136#M82794</link>
      <description>&lt;P&gt;When comparing a string literal to a character variable, "" is equivalent to " ", because a missing character variable is always filled with blanks, and the minimum length for a character variable is 1.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 14:35:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Blanks/m-p/354136#M82794</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-04-27T14:35:48Z</dc:date>
    </item>
  </channel>
</rss>

