<?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 return blank character values in an if statement in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/return-blank-character-values-in-an-if-statement/m-p/919433#M41184</link>
    <description>&lt;P&gt;Hi smart people.&lt;/P&gt;&lt;P&gt;I have the following code:&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;if dep="1309825" then dep="" AND source_dep=. AND indexdate_dep=.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dep is a character value(it can contain letters) and is 11 characters long. SAS returns a 0 rather then a blank when i run this and I want a blank. I have tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if scan(dep,1,"1309825")=1 then dep="" AND ... and the rest, but the result is the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i Have also tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if lenght(dep)=7 and dep="1309825" then dep="" AND ... the rest, also with the same result.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I make it return a blank and not a zero?&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;</description>
    <pubDate>Fri, 08 Mar 2024 12:16:04 GMT</pubDate>
    <dc:creator>miajoe</dc:creator>
    <dc:date>2024-03-08T12:16:04Z</dc:date>
    <item>
      <title>return blank character values in an if statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/return-blank-character-values-in-an-if-statement/m-p/919433#M41184</link>
      <description>&lt;P&gt;Hi smart people.&lt;/P&gt;&lt;P&gt;I have the following code:&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;if dep="1309825" then dep="" AND source_dep=. AND indexdate_dep=.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dep is a character value(it can contain letters) and is 11 characters long. SAS returns a 0 rather then a blank when i run this and I want a blank. I have tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if scan(dep,1,"1309825")=1 then dep="" AND ... and the rest, but the result is the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i Have also tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if lenght(dep)=7 and dep="1309825" then dep="" AND ... the rest, also with the same result.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I make it return a blank and not a zero?&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 12:16:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/return-blank-character-values-in-an-if-statement/m-p/919433#M41184</guid>
      <dc:creator>miajoe</dc:creator>
      <dc:date>2024-03-08T12:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: return blank character values in an if statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/return-blank-character-values-in-an-if-statement/m-p/919435#M41185</link>
      <description>&lt;P&gt;I solved it. I just wanted to do to much in one go. When i split it up into three seperate if statements and replaced ="" with =" " it worked. So sorry to waste anyones time.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 12:26:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/return-blank-character-values-in-an-if-statement/m-p/919435#M41185</guid>
      <dc:creator>miajoe</dc:creator>
      <dc:date>2024-03-08T12:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: return blank character values in an if statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/return-blank-character-values-in-an-if-statement/m-p/919437#M41186</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if dep="1309825" then dep="" AND source_dep=. AND indexdate_dep=.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You want a blank, not a zero. Normally an assignment statement in a data step looks like this, where variable name is to the left of the equal sign and value assigned to the variable name is to the right of the equal sign.&amp;nbsp;I'm surprised your code works at all, but I have never tried it. Perhaps you want (I'm guessing):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if dep='123456' then do;
    source_dep=. ;
    indexdate_dep=.;
    dep=" ";
end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 12:34:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/return-blank-character-values-in-an-if-statement/m-p/919437#M41186</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-03-08T12:34:21Z</dc:date>
    </item>
  </channel>
</rss>

