<?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: syntax for Two nested case statements in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752708#M237140</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;yes, I need to nest my case statement within another case statement of within an if else statement:&lt;/P&gt;
&lt;P&gt;but I have to say if the sort is like field1 &amp;gt; field 2, then&lt;/P&gt;
&lt;P&gt;else somethingelse&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;But within each part of if else we have case statements.&lt;/P&gt;
&lt;P&gt;I hope this makes sense.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Jul 2021 20:34:32 GMT</pubDate>
    <dc:creator>GN0001</dc:creator>
    <dc:date>2021-07-07T20:34:32Z</dc:date>
    <item>
      <title>syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752632#M237120</link>
      <description>&lt;P&gt;Hello team,&lt;BR /&gt;I want to write two nested case statements:&lt;/P&gt;
&lt;P&gt;case1 &lt;BR /&gt;field1 &amp;gt; field2 and field2&amp;gt; field3 and field3 &amp;gt;field4 then&lt;BR /&gt;case1&lt;BR /&gt;case2&lt;BR /&gt;case3&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;case2 field1 &amp;lt; field2 and field2&amp;lt; field3 and field3 &amp;lt;field4 then&lt;BR /&gt;case1&lt;BR /&gt;case2&lt;BR /&gt;case3&lt;/P&gt;
&lt;P&gt;What would be the syntax? Or is this doable?&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Blue blue&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 17:50:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752632#M237120</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-07-07T17:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752659#M237124</link>
      <description>&lt;P&gt;I don't really understand what you are trying to do.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Can you explain in words? Can you give a small example?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 18:49:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752659#M237124</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-07T18:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752663#M237127</link>
      <description>You're trying to check if the fields are sorted in order of ascending or descending?</description>
      <pubDate>Wed, 07 Jul 2021 19:24:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752663#M237127</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-07T19:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752686#M237133</link>
      <description>How can I check?&lt;BR /&gt;So would that be;&lt;BR /&gt;If  field1 &amp;gt; field2 then&lt;BR /&gt;When case ….then,,,&lt;BR /&gt;When case….then…&lt;BR /&gt;End as ‘this’&lt;BR /&gt;&lt;BR /&gt;Else&lt;BR /&gt;&lt;BR /&gt;When case.,,,then….&lt;BR /&gt;When case….then.,.&lt;BR /&gt;&lt;BR /&gt;End as ‘that’&lt;BR /&gt;&lt;BR /&gt;End if&lt;BR /&gt;&lt;BR /&gt;Regards. &lt;BR /&gt;Blueblue</description>
      <pubDate>Wed, 07 Jul 2021 20:08:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752686#M237133</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-07-07T20:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752694#M237135</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;If field1 &amp;gt; field2 then&lt;BR /&gt;When case ….then,,,&lt;BR /&gt;When case….then…&lt;BR /&gt;End as ‘this’&lt;/P&gt;
&lt;P&gt;Else&lt;/P&gt;
&lt;P&gt;When case.,,,then….&lt;BR /&gt;When case….then.,.&lt;/P&gt;
&lt;P&gt;End as ‘that’&lt;/P&gt;
&lt;P&gt;End if&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;I still don't understand the question.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 20:19:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752694#M237135</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-07T20:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752700#M237138</link>
      <description>Your title and code/comments do not align. Are you trying to nest your CASE statements? It would be better if you explained what you were trying to do.</description>
      <pubDate>Wed, 07 Jul 2021 20:25:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752700#M237138</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-07T20:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752708#M237140</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;yes, I need to nest my case statement within another case statement of within an if else statement:&lt;/P&gt;
&lt;P&gt;but I have to say if the sort is like field1 &amp;gt; field 2, then&lt;/P&gt;
&lt;P&gt;else somethingelse&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;But within each part of if else we have case statements.&lt;/P&gt;
&lt;P&gt;I hope this makes sense.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 20:34:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752708#M237140</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-07-07T20:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752710#M237141</link>
      <description>Unfortunately this still doesn't make sense, especially since CASE statements are a SQL concept and IF/ELSE is a data step so not sure how you would nest those? Typically a CASE statement is the IF/ELSE from a data step. &lt;BR /&gt;&lt;BR /&gt;I think it's time you illustrate your problem with some example data. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Jul 2021 20:36:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752710#M237141</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-07T20:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752714#M237142</link>
      <description>&lt;P&gt;Reeza,&lt;/P&gt;
&lt;P&gt;Thanks for the response.&lt;/P&gt;
&lt;P&gt;This is the sketch of what I have in mind.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;case&lt;/P&gt;
&lt;P&gt;When (field1&amp;gt;field2 and field2&amp;gt;field3) Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; when this then than /*this is nested within the first case*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;when this then than /*this is nested within the first case*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;/P&gt;
&lt;P&gt;When (field1&amp;lt;field2 and field2&amp;lt;field3) Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;case&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; when this then than /*this is nested within the first case*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;when this then than /*this is nested within the first case*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;/P&gt;
&lt;P&gt;end&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the response.&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 20:47:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752714#M237142</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-07-07T20:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752716#M237143</link>
      <description>It's structured correctly then, so what is the issue? Did your code like that not work?</description>
      <pubDate>Wed, 07 Jul 2021 20:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752716#M237143</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-07T20:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752720#M237144</link>
      <description>&lt;P&gt;Entirely useless example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table example as
select *, case when age &amp;lt;14 then (case when sex = 'F' then "FEMALE" else "MALE" end) 
               when age &amp;gt;=14 then (case when sex = 'F' then "Female" else "Male" end) end as gender
from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Jul 2021 20:54:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/752720#M237144</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-07T20:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/753415#M237444</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Please refer to this:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You're trying to check if the fields are sorted in order of ascending or descending?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yes, I am trying to see how I need to write it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;blue blue&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 03:32:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/753415#M237444</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-07-12T03:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/753416#M237445</link>
      <description>&lt;P&gt;Yes, I am trying to nest two case statement.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 03:33:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/753416#M237445</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-07-12T03:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/753417#M237446</link>
      <description>I am working on it to see who to write. I am thinking about the logic.&lt;BR /&gt;Thanks,&lt;BR /&gt;blueblue</description>
      <pubDate>Mon, 12 Jul 2021 03:34:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/753417#M237446</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-07-12T03:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/753418#M237447</link>
      <description>&lt;P&gt;Please give me some time to test it.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 03:35:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/753418#M237447</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-07-12T03:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: syntax for Two nested case statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/753419#M237448</link>
      <description>&lt;P&gt;why useless!!?&lt;/P&gt;
&lt;P&gt;I already have a screenshot of it.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 03:36:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/syntax-for-Two-nested-case-statements/m-p/753419#M237448</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-07-12T03:36:48Z</dc:date>
    </item>
  </channel>
</rss>

