<?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: Create a sas variable using select statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-variable-using-select-statement/m-p/245673#M45875</link>
    <description>&lt;P&gt;Awesome. You can list multiple conditions in your WHEN statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data chemo;
  set adph;
select (Chemotherapy);
   when('chemoth', 'recoome') chemo='Yes chemo';
   otherwise chemo='No chemo';
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 24 Jan 2016 05:28:49 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-01-24T05:28:49Z</dc:date>
    <item>
      <title>Create a sas variable using select statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-variable-using-select-statement/m-p/245656#M45869</link>
      <description>&lt;P&gt;Objective:&lt;/P&gt;
&lt;P&gt;I was interested to create a new variable "treat" , to read the data,&amp;nbsp; and provide information about cancer patient frequency of those taking chemotherapy or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data chemo1;&lt;BR /&gt;&amp;nbsp; set adph;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; select(Chemotherapy);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; when(0) treat="No chemo";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (1) treat="Yes Chemo";&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;otherwise;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;proc freq data=chemo1;&lt;BR /&gt;&amp;nbsp; table treat/chisq;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After I ran the above code, produce all the data as missing with the new variable "treat". I need your help.Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jan 2016 00:07:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-variable-using-select-statement/m-p/245656#M45869</guid>
      <dc:creator>abuanuazu</dc:creator>
      <dc:date>2016-01-24T00:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: Create a sas variable using select statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-variable-using-select-statement/m-p/245659#M45870</link>
      <description>&lt;P&gt;Without data we can't really comment. But you can change your proc freq to help diagnose the issue.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post the results from the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=chemo1;
&amp;nbsp; table chemotherapy*treat/chisq missing list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jan 2016 00:15:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-variable-using-select-statement/m-p/245659#M45870</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-24T00:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Create a sas variable using select statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-variable-using-select-statement/m-p/245665#M45871</link>
      <description>&lt;P&gt;Dear Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for prompt response. Still I need more assistance. As per your code, the result attached. It picks all the patients as "No chemo". Please find here is attached the sub-variables under Chemotherapy and the data type is boolean as 1 or 0.Thank you again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Abuanuazu&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jan 2016 01:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-variable-using-select-statement/m-p/245665#M45871</guid>
      <dc:creator>abuanuazu</dc:creator>
      <dc:date>2016-01-24T01:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create a sas variable using select statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-variable-using-select-statement/m-p/245666#M45872</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help. Finally, I got the solution to the problem&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data chemo;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set adph;&lt;/P&gt;
&lt;P&gt;select (Chemotherapy);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when('"chemoth') chemo='Yes chemo';&lt;BR /&gt;&amp;nbsp;&amp;nbsp; when('"recomme') chemo='Yes chemo';&lt;BR /&gt;&amp;nbsp;&amp;nbsp; otherwise chemo='No chemo';&lt;BR /&gt;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jan 2016 02:22:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-variable-using-select-statement/m-p/245666#M45872</guid>
      <dc:creator>abuanuazu</dc:creator>
      <dc:date>2016-01-24T02:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create a sas variable using select statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-variable-using-select-statement/m-p/245673#M45875</link>
      <description>&lt;P&gt;Awesome. You can list multiple conditions in your WHEN statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data chemo;
  set adph;
select (Chemotherapy);
   when('chemoth', 'recoome') chemo='Yes chemo';
   otherwise chemo='No chemo';
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 24 Jan 2016 05:28:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-variable-using-select-statement/m-p/245673#M45875</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-24T05:28:49Z</dc:date>
    </item>
  </channel>
</rss>

