<?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 SELECT WHEN in DS2 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SELECT-WHEN-in-DS2/m-p/649615#M194787</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when I use SELECT-WHEN in a PROC DS2 and list more than 1 value after a WHEN, SAS throws an error: "Parse encountered constant when expecting ')'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this behavior (which differs from a DATA Step) intended?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example: The following code works as long as no additional values are added after a WHEN as shown in the commented line (uncomment and the error will occur):&lt;/P&gt;&lt;PRE&gt;proc ds2;

data _null_;

    method init();
        dcl varchar(8) test;

        test = 'b';

        select( test );
            when( 'b' ) put 'Beginning';&lt;BR /&gt;            /*when( 'b', 'B' ) put 'Beginning';*/
            when( 'm' ) put 'Middle';
            when( 'e' ) put 'End';
        end;
    end;
enddata;
run;
quit;&lt;/PRE&gt;</description>
    <pubDate>Thu, 21 May 2020 15:46:42 GMT</pubDate>
    <dc:creator>Luhan</dc:creator>
    <dc:date>2020-05-21T15:46:42Z</dc:date>
    <item>
      <title>SELECT WHEN in DS2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SELECT-WHEN-in-DS2/m-p/649615#M194787</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when I use SELECT-WHEN in a PROC DS2 and list more than 1 value after a WHEN, SAS throws an error: "Parse encountered constant when expecting ')'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this behavior (which differs from a DATA Step) intended?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example: The following code works as long as no additional values are added after a WHEN as shown in the commented line (uncomment and the error will occur):&lt;/P&gt;&lt;PRE&gt;proc ds2;

data _null_;

    method init();
        dcl varchar(8) test;

        test = 'b';

        select( test );
            when( 'b' ) put 'Beginning';&lt;BR /&gt;            /*when( 'b', 'B' ) put 'Beginning';*/
            when( 'm' ) put 'Middle';
            when( 'e' ) put 'End';
        end;
    end;
enddata;
run;
quit;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 May 2020 15:46:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SELECT-WHEN-in-DS2/m-p/649615#M194787</guid>
      <dc:creator>Luhan</dc:creator>
      <dc:date>2020-05-21T15:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT WHEN in DS2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SELECT-WHEN-in-DS2/m-p/649619#M194789</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select( test );
  when( 'b' )
  when( 'B' ) put 'Beginning';
  when( 'm' ) put 'Middle';
  when( 'e' ) put 'End';
end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 May 2020 15:58:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SELECT-WHEN-in-DS2/m-p/649619#M194789</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-21T15:58:43Z</dc:date>
    </item>
  </channel>
</rss>

