<?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: SAS VFL 4 Calculate columns node in SAS Viya</title>
    <link>https://communities.sas.com/t5/SAS-Viya/SAS-VFL-4-Calculate-columns-node/m-p/932857#M2447</link>
    <description>&lt;P&gt;It would be a good idea for you to describe the variables, conditions and needed results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sometimes the point and click interface is not the best way to get results and CASE when syntax can get extremely cumbersome if there are large numbers of different results and variables involved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;case categoryvariable     &amp;lt;= variable to use in all comparisons
   when 'A' then  2.5        &amp;lt;= compare variable to 'A' and set result
   when 'B' then  3.7        &amp;lt;= compare variable to 'B' and set result
   when 'C' then  4.4        &amp;lt;= compare variable to 'C' and set result
   else 1                    &amp;lt;= result for all other values of the variable
end   as multiplier          &amp;lt;= end the Case expression assign result to multiplier&lt;/PRE&gt;</description>
    <pubDate>Tue, 18 Jun 2024 15:07:34 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-06-18T15:07:34Z</dc:date>
    <item>
      <title>SAS VFL 4 Calculate columns node</title>
      <link>https://communities.sas.com/t5/SAS-Viya/SAS-VFL-4-Calculate-columns-node/m-p/932854#M2446</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pic.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97598i0F505CF5EF947D57/image-size/large?v=v2&amp;amp;px=999" role="button" title="Pic.jpg" alt="Pic.jpg" /&gt;&lt;/span&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using VFL 4 SAS Studio. I want to create a new column using a conditional statement (see image below). I cannot write the case when although the software provides guidelines:&lt;/P&gt;&lt;P&gt;CASE &amp;lt;case-operand&amp;gt;&lt;BR /&gt;WHEN when-condition&lt;BR /&gt;THEN result-expression&lt;BR /&gt;&amp;lt;ELSE result-expression&amp;gt;&lt;BR /&gt;END&lt;/P&gt;&lt;P&gt;Can you provide an example?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="azaras_0-1718722343416.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97596i131A262BB3CEE457/image-size/medium?v=v2&amp;amp;px=400" role="button" title="azaras_0-1718722343416.png" alt="azaras_0-1718722343416.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="azaras_1-1718722367526.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97597iAB467618F1A98454/image-size/medium?v=v2&amp;amp;px=400" role="button" title="azaras_1-1718722367526.png" alt="azaras_1-1718722367526.png" /&gt;&lt;/span&gt;&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>Tue, 18 Jun 2024 14:55:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/SAS-VFL-4-Calculate-columns-node/m-p/932854#M2446</guid>
      <dc:creator>azaras</dc:creator>
      <dc:date>2024-06-18T14:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: SAS VFL 4 Calculate columns node</title>
      <link>https://communities.sas.com/t5/SAS-Viya/SAS-VFL-4-Calculate-columns-node/m-p/932857#M2447</link>
      <description>&lt;P&gt;It would be a good idea for you to describe the variables, conditions and needed results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sometimes the point and click interface is not the best way to get results and CASE when syntax can get extremely cumbersome if there are large numbers of different results and variables involved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;case categoryvariable     &amp;lt;= variable to use in all comparisons
   when 'A' then  2.5        &amp;lt;= compare variable to 'A' and set result
   when 'B' then  3.7        &amp;lt;= compare variable to 'B' and set result
   when 'C' then  4.4        &amp;lt;= compare variable to 'C' and set result
   else 1                    &amp;lt;= result for all other values of the variable
end   as multiplier          &amp;lt;= end the Case expression assign result to multiplier&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Jun 2024 15:07:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/SAS-VFL-4-Calculate-columns-node/m-p/932857#M2447</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-06-18T15:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: SAS VFL 4 Calculate columns node</title>
      <link>https://communities.sas.com/t5/SAS-Viya/SAS-VFL-4-Calculate-columns-node/m-p/932869#M2448</link>
      <description>&lt;P&gt;Hi, Thanks for your answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the following into the log&amp;nbsp;&amp;nbsp;so i guess case is not a valid way for the condiitonal proceccing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ANt ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thnaks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;NOTE: The data set WORK._TMP_0F2A7CAC2D8C11EF87B43A81D86 has 0 observations and 13 variables.&lt;/DIV&gt;&lt;DIV class=""&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class=""&gt;real time 0.00 seconds&lt;/DIV&gt;&lt;DIV class=""&gt;cpu time 0.01 seconds&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;138&lt;/DIV&gt;&lt;DIV class=""&gt;139 data null;&lt;/DIV&gt;&lt;DIV class=""&gt;140 set work._tmp_0f2a7cac2d8c11ef87b43a81d86;&lt;/DIV&gt;&lt;DIV class=""&gt;141 __valid_expr=case (Order_Type)&lt;/DIV&gt;&lt;DIV class=""&gt;----&lt;/DIV&gt;&lt;DIV class=""&gt;68&lt;/DIV&gt;&lt;DIV class=""&gt;142 when 1 then 2.5&lt;/DIV&gt;&lt;DIV class=""&gt;----&lt;/DIV&gt;&lt;DIV class=""&gt;22&lt;/DIV&gt;&lt;DIV class=""&gt;76&lt;/DIV&gt;&lt;DIV class=""&gt;ERROR 68-185: The function CASE is unknown, or cannot be accessed.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, -, /, ;, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT,&lt;/DIV&gt;&lt;DIV class=""&gt;IN, LE, LT, MAX, MIN, NE, NG, NL, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 16:04:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/SAS-VFL-4-Calculate-columns-node/m-p/932869#M2448</guid>
      <dc:creator>azaras</dc:creator>
      <dc:date>2024-06-18T16:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS VFL 4 Calculate columns node</title>
      <link>https://communities.sas.com/t5/SAS-Viya/SAS-VFL-4-Calculate-columns-node/m-p/932876#M2449</link>
      <description>&lt;P&gt;When i use thre Query node everythiong is fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Case (Order_Type)&lt;/P&gt;
&lt;P&gt;when 1 then 'X'&lt;/P&gt;
&lt;P&gt;when 2 then 'Y'&lt;/P&gt;
&lt;P&gt;else 'V'&lt;/P&gt;
&lt;P&gt;end&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Though in the computed columns node it does not work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 16:17:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/SAS-VFL-4-Calculate-columns-node/m-p/932876#M2449</guid>
      <dc:creator>azaras</dc:creator>
      <dc:date>2024-06-18T16:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS VFL 4 Calculate columns node</title>
      <link>https://communities.sas.com/t5/SAS-Viya/SAS-VFL-4-Calculate-columns-node/m-p/932885#M2450</link>
      <description>&lt;P&gt;The computed column node sims to have an issue. I will use the Query in stead that is working properly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 17:37:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/SAS-VFL-4-Calculate-columns-node/m-p/932885#M2450</guid>
      <dc:creator>azaras</dc:creator>
      <dc:date>2024-06-18T17:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: SAS VFL 4 Calculate columns node</title>
      <link>https://communities.sas.com/t5/SAS-Viya/SAS-VFL-4-Calculate-columns-node/m-p/932887#M2451</link>
      <description>&lt;P&gt;CASE /WHEN is SQL syntax, not DATA step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even at that the "new column" comes after the END of the Case construct&lt;/P&gt;
&lt;P&gt;Case when &amp;lt;condition&amp;gt; result&lt;/P&gt;
&lt;P&gt;end as NEWCOLUMN&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data step would use IF/Then or SELECT&lt;/P&gt;
&lt;PRE&gt;If variable = value then newvariable=something;
ELSE if variable= othervalue then Newvariable=somethingelse;
&amp;lt;else ...&amp;gt;&lt;/PRE&gt;
&lt;P&gt;Or&lt;/P&gt;
&lt;PRE&gt;Select (variable);
   when (value) NewVariable=something;
   when (othervalue) Newvariable=somethingelse;
   otherwise &amp;lt;what to do when none of the listed values are encountered&amp;gt;;
end;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Jun 2024 17:56:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/SAS-VFL-4-Calculate-columns-node/m-p/932887#M2451</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-06-18T17:56:42Z</dc:date>
    </item>
  </channel>
</rss>

