<?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: case statement with the values from another variables in the dataset after then in a proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/case-statement-with-the-values-from-another-variables-in-the/m-p/751471#M236558</link>
    <description>&lt;P&gt;Can you elaborate please. Your question is not comprehensible.&lt;BR /&gt;Do refer to SAS documentation on Proc SQL some of your questions may be answered there.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Jul 2021 14:38:17 GMT</pubDate>
    <dc:creator>Sajid01</dc:creator>
    <dc:date>2021-07-01T14:38:17Z</dc:date>
    <item>
      <title>case statement with the values from another variables in the dataset after then in a proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/case-statement-with-the-values-from-another-variables-in-the/m-p/751394#M236534</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;How to point to another variable in a case statement in a proc sql?&lt;/P&gt;
&lt;P&gt;I need to have some calculation after then instead of literal. Instead of something, I need to multiply the value of a variable in the table * by the value of another variable in the table. After then, it is a calculation of two values from two variables from same dataset.&lt;/P&gt;
&lt;PRE&gt;Proc sql;
   create table junk as
   select *,
      case 
         when sex= 'F' then 'something'
         when sex= 'M' then 'something else'
         else 'Error'
      end as newvar label='This is a Sex based value'
   from sashelp.class
   ;
run;&lt;/PRE&gt;
&lt;P&gt;Respectfully,&lt;/P&gt;
&lt;P&gt;Blue blue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jul 2021 03:46:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/case-statement-with-the-values-from-another-variables-in-the/m-p/751394#M236534</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-07-01T03:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: case statement with the values from another variables in the dataset after then in a proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/case-statement-with-the-values-from-another-variables-in-the/m-p/751471#M236558</link>
      <description>&lt;P&gt;Can you elaborate please. Your question is not comprehensible.&lt;BR /&gt;Do refer to SAS documentation on Proc SQL some of your questions may be answered there.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jul 2021 14:38:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/case-statement-with-the-values-from-another-variables-in-the/m-p/751471#M236558</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-07-01T14:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: case statement with the values from another variables in the dataset after then in a proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/case-statement-with-the-values-from-another-variables-in-the/m-p/751473#M236560</link>
      <description>&lt;P&gt;If you provide a more detailed example of what you are trying to do then you can get a better answer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds like you want something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table junk as
  select *
       , case 
           when sex= 'F' then weight*height
           when sex= 'M' then age
           else .
         end as newvar label='This is a Sex based value'
  from sashelp.class
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jul 2021 14:53:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/case-statement-with-the-values-from-another-variables-in-the/m-p/751473#M236560</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-07-01T14:53:12Z</dc:date>
    </item>
  </channel>
</rss>

