<?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: Formats for negative values in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Formats-for-negative-values/m-p/457631#M14162</link>
    <description>&lt;P&gt;Thats not how an SQL statement is made.&amp;nbsp; You may want to read up on how to create SQL statements, as that is a basic mistake using SAS syntax in SQL:&lt;/P&gt;&lt;PRE class="language-sas lia-code-sample" data-lia-code-lang="sas" data-lia-code-macro="true"&gt;&lt;CODE class="  language-sas"&gt;case when claim_amt_type_cd&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'2' &lt;/SPAN&gt;and subtype_cd&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'2'&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;-amt&lt;/SPAN&gt; else amt end as amt&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I.e.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case&lt;BR /&gt; &amp;nbsp;when &amp;lt;condition or value&amp;gt; then &amp;lt;value&amp;gt;
  when &amp;lt;condition or value&amp;gt; then &amp;lt;value&amp;gt;&lt;BR /&gt;  else &amp;lt;value&amp;gt;&lt;BR /&gt;end as &amp;lt;variable&amp;gt; &lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Forum seems broken again, can't use two code blocks!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Edit (KB): I managed to put your second example into a code window; might be your browser?&lt;/EM&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Apr 2018 08:59:39 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-04-26T08:59:39Z</dc:date>
    <item>
      <title>Formats for negative values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Formats-for-negative-values/m-p/457626#M14161</link>
      <description>&lt;P&gt;I'm creating one variable called 'VBHTO' in target dataset DI studio and it was coming from the variable AMT from source dataset. Now I was asked&amp;nbsp;to convert any positive values from the&amp;nbsp;&lt;SPAN&gt;variable &amp;nbsp;'VBHTO' to negative value. e.g. if VBHTO is 40 then should be converted to -40.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I've added the following condition&amp;nbsp;under 'Expression' earlier. Format of this variable is 18.2.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when CLAIM_AMT_TYPE_CD='2'  and SUBTYPE_CD='2' then AMT
end&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Now when I modify the same condition as below to incorporate&amp;nbsp;the new changes, I was not seeing any changes&amp;nbsp;in the output. Appreciate if someone of you help me with the solution and to tackle this issue.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when CLAIM_AMT_TYPE_CD='2'  and SUBTYPE_CD='2' then AMT=&lt;STRONG&gt;-AMT&lt;/STRONG&gt;
end&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 08:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Formats-for-negative-values/m-p/457626#M14161</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2018-04-26T08:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Formats for negative values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Formats-for-negative-values/m-p/457631#M14162</link>
      <description>&lt;P&gt;Thats not how an SQL statement is made.&amp;nbsp; You may want to read up on how to create SQL statements, as that is a basic mistake using SAS syntax in SQL:&lt;/P&gt;&lt;PRE class="language-sas lia-code-sample" data-lia-code-lang="sas" data-lia-code-macro="true"&gt;&lt;CODE class="  language-sas"&gt;case when claim_amt_type_cd&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'2' &lt;/SPAN&gt;and subtype_cd&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'2'&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;-amt&lt;/SPAN&gt; else amt end as amt&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I.e.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case&lt;BR /&gt; &amp;nbsp;when &amp;lt;condition or value&amp;gt; then &amp;lt;value&amp;gt;
  when &amp;lt;condition or value&amp;gt; then &amp;lt;value&amp;gt;&lt;BR /&gt;  else &amp;lt;value&amp;gt;&lt;BR /&gt;end as &amp;lt;variable&amp;gt; &lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Forum seems broken again, can't use two code blocks!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Edit (KB): I managed to put your second example into a code window; might be your browser?&lt;/EM&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 08:59:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Formats-for-negative-values/m-p/457631#M14162</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-26T08:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: Formats for negative values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Formats-for-negative-values/m-p/457664#M14163</link>
      <description>&lt;P&gt;It's not working. I used the following code in expression, and the job was successful but it failed to convert it to negative values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 10:19:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Formats-for-negative-values/m-p/457664#M14163</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2018-04-26T10:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Formats for negative values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Formats-for-negative-values/m-p/457666#M14164</link>
      <description>&lt;P&gt;No code provided.&amp;nbsp; No test data provided.&amp;nbsp; "It's not working" - tells us nothing.&amp;nbsp; This does work:&lt;/P&gt;
&lt;PRE&gt;data have;
  a=3;
run;

data want;
  set have;
  b=-a;
run;&lt;/PRE&gt;
&lt;P&gt;So what is it your doing which is not working?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 10:27:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Formats-for-negative-values/m-p/457666#M14164</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-26T10:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: Formats for negative values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Formats-for-negative-values/m-p/457681#M14165</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8409"&gt;@Babloo&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;It's not working. I used the following code in expression, and the job was successful but it failed to convert it to negative values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8409"&gt;@Babloo&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Then most likely your condition is not working as you believe and it got never TRUE. If you just want to test that the condition works then use something like 1=1 as condition and then test what you get for AMT.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 11:26:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Formats-for-negative-values/m-p/457681#M14165</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-04-26T11:26:37Z</dc:date>
    </item>
  </channel>
</rss>

