<?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 group statement error. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Select-group-statement-error/m-p/229494#M41536</link>
    <description>&lt;P&gt;I am just a very beginner SAS programmer. I am trying to do the following inside a data step:&lt;/P&gt;&lt;P&gt;data work.gifts;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; set orion.nonsales;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; length Gift1 $7 Gift2 $10;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Gift1=select (Gender) when ('M') 'gloves'&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; when ('F') 'scarves'&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;otherwise 'caffee'&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;However I am getting this error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ERROR 68-185: The function SELECT is unknown&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Gender is a variable included already in the nonsales table and Gift1 and Gift2 are two new variables that I am trying to conditionally initialize based on the value in the variable Gender.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help would be really appreciated! Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Oct 2015 04:45:39 GMT</pubDate>
    <dc:creator>gfdan3011</dc:creator>
    <dc:date>2015-10-12T04:45:39Z</dc:date>
    <item>
      <title>Select group statement error.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-group-statement-error/m-p/229494#M41536</link>
      <description>&lt;P&gt;I am just a very beginner SAS programmer. I am trying to do the following inside a data step:&lt;/P&gt;&lt;P&gt;data work.gifts;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; set orion.nonsales;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; length Gift1 $7 Gift2 $10;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Gift1=select (Gender) when ('M') 'gloves'&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; when ('F') 'scarves'&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;otherwise 'caffee'&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;However I am getting this error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ERROR 68-185: The function SELECT is unknown&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Gender is a variable included already in the nonsales table and Gift1 and Gift2 are two new variables that I am trying to conditionally initialize based on the value in the variable Gender.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help would be really appreciated! Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2015 04:45:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-group-statement-error/m-p/229494#M41536</guid>
      <dc:creator>gfdan3011</dc:creator>
      <dc:date>2015-10-12T04:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Select group statement error.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-group-statement-error/m-p/229498#M41537</link>
      <description>&lt;P&gt;SELECT in the Base SAS language is a statement and not a function. You can only use functions on the right side of an equal sign.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the SELECT statement your code could look as follows (untested):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.gifts;
  set orion.nonsales;
  length Gift1 $7 Gift2 $10;
  select(gender);
    when('M') gift1='gloves';
    when('F') gift1='scarves';
    otherwise 'coffee';
  end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Oct 2015 06:46:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-group-statement-error/m-p/229498#M41537</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-10-12T06:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Select group statement error.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-group-statement-error/m-p/229499#M41538</link>
      <description>&lt;P&gt;Your syntax is slightly wrong - you're using SELECT as a function when it's a statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are some examples of correct usage and documentation&amp;nbsp;here -&amp;gt;&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/68024/HTML/default/viewer.htm#p09213s9jc2t99n1vx0omk2rh9ps.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lestmtsref/68024/HTML/default/viewer.htm#p09213s9jc2t99n1vx0omk2rh9ps.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2015 06:49:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-group-statement-error/m-p/229499#M41538</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2015-10-12T06:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: Select group statement error.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-group-statement-error/m-p/231574#M42152</link>
      <description>&lt;P&gt;Thank you so much Patrick! It did work!&lt;/P&gt;&lt;P&gt;I was trying to find that wrong example that I used as an inspiration but without success. If I will find it, I will post it and let SAS know about it.&lt;/P&gt;&lt;P&gt;Also, I apologize for my late reply! I had to prepare for a couple of interviews.&lt;/P&gt;&lt;P&gt;Thank you again!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 02:32:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-group-statement-error/m-p/231574#M42152</guid>
      <dc:creator>gfdan3011</dc:creator>
      <dc:date>2015-10-26T02:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: Select group statement error.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-group-statement-error/m-p/231575#M42153</link>
      <description>&lt;P&gt;Thank you Chris! You were right! I really appreciate the web link too!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 02:36:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-group-statement-error/m-p/231575#M42153</guid>
      <dc:creator>gfdan3011</dc:creator>
      <dc:date>2015-10-26T02:36:21Z</dc:date>
    </item>
  </channel>
</rss>

