<?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: Help: Proc sql - selecting a blank value as a space ' ' in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-Proc-sql-selecting-a-blank-value-as-a-space/m-p/413322#M26575</link>
    <description>&lt;P&gt;How are you sending the file to the "business"?&amp;nbsp; &amp;nbsp;The reason being is that " " is just an empty string in SAS, you can put out data which "looks" like spaces, this for instance puts spaces to the length of the string.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set sashelp.class;
  if sex="M" then res=" ";
  else res="X";
  put "Res='" res "'";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So the question is how you are writing data to this "file" you mention.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Nov 2017 13:53:46 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-11-14T13:53:46Z</dc:date>
    <item>
      <title>Help: Proc sql - selecting a blank value as a space ' '</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-Proc-sql-selecting-a-blank-value-as-a-space/m-p/413317#M26574</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having trouble selecting blank values as a space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have a requirement where we need to provide a file to the business.&lt;/P&gt;&lt;P&gt;Blank values must = ' ' (a space).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to use the below case statement (which works on MS sql and oracle - I am new to SAS).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;case when INTERRUPTION_TYPE = '' then ' '&lt;BR /&gt;else INTERRUPTION_TYPE end as INTERRUPTION_TYPE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The results return the blank values as a blank - no space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I use the below, it will return an x so I know that my query is picking up the correct values but not returning a space when i want it to.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;case when INTERRUPTION_TYPE = '' then 'x'&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else INTERRUPTION_TYPE end as INTERRUPTION_TYPE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 13:42:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-Proc-sql-selecting-a-blank-value-as-a-space/m-p/413317#M26574</guid>
      <dc:creator>Shwam</dc:creator>
      <dc:date>2017-11-14T13:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Proc sql - selecting a blank value as a space ' '</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-Proc-sql-selecting-a-blank-value-as-a-space/m-p/413322#M26575</link>
      <description>&lt;P&gt;How are you sending the file to the "business"?&amp;nbsp; &amp;nbsp;The reason being is that " " is just an empty string in SAS, you can put out data which "looks" like spaces, this for instance puts spaces to the length of the string.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set sashelp.class;
  if sex="M" then res=" ";
  else res="X";
  put "Res='" res "'";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So the question is how you are writing data to this "file" you mention.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 13:53:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-Proc-sql-selecting-a-blank-value-as-a-space/m-p/413322#M26575</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-11-14T13:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Proc sql - selecting a blank value as a space ' '</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-Proc-sql-selecting-a-blank-value-as-a-space/m-p/413328#M26576</link>
      <description>&lt;P&gt;Keep in mind that SAS character variables are always padded with blanks. Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
length x1 $10 x2 $20;
x1 = '';
x2 = put(x1,$hex20.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and look at the resulting dataset.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 14:10:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-Proc-sql-selecting-a-blank-value-as-a-space/m-p/413328#M26576</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-11-14T14:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Proc sql - selecting a blank value as a space ' '</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-Proc-sql-selecting-a-blank-value-as-a-space/m-p/413340#M26579</link>
      <description>&lt;P&gt;Thanks for the quick response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will play around with this as soon as I'm back in the office tomorrow morning.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There any chance you could help with a solution in proc sql?&lt;/P&gt;&lt;P&gt;My data step skills are very entry level and we have written the entire script in sql&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 14:37:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-Proc-sql-selecting-a-blank-value-as-a-space/m-p/413340#M26579</guid>
      <dc:creator>Shwam</dc:creator>
      <dc:date>2017-11-14T14:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Proc sql - selecting a blank value as a space ' '</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-Proc-sql-selecting-a-blank-value-as-a-space/m-p/413906#M26617</link>
      <description>&lt;P&gt;My data step is only there to illustrate that&lt;/P&gt;
&lt;PRE&gt;'' = ' '&lt;/PRE&gt;
&lt;P&gt;in SAS. Since SAS does not know a varchar type, but only character with a given length (&amp;gt;= 1), all empty/missing character variables will at least contain one blank, so a statement in SQL like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case
  when X = ''
  then ' '
  else X
end as X
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;won't change anything. You need to redefine your logic in light of this fact.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2017 07:35:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-Proc-sql-selecting-a-blank-value-as-a-space/m-p/413906#M26617</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-11-16T07:35:18Z</dc:date>
    </item>
  </channel>
</rss>

