<?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: how to create a new variable based on a condition in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-new-variable-based-on-a-condition/m-p/454337#M114832</link>
    <description>&lt;P&gt;COALESCE() can come in handy.&lt;/P&gt;
&lt;P&gt;Read through the function list, the best&amp;nbsp;way to know what options you have&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Apr 2018 03:16:52 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-04-16T03:16:52Z</dc:date>
    <item>
      <title>how to create a new variable based on a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-new-variable-based-on-a-condition/m-p/454332#M114828</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;
&lt;P&gt;With my code I am&amp;nbsp; getting my output.&lt;/P&gt;
&lt;P&gt;Are there any other way I can&amp;nbsp; write the code&amp;nbsp; in the second data step. Thank you&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
input date1 date2 date3 date4;
informat date: yymmdd10.;
format date: yymmdd10.;
datalines;
2015-10-01 2015-10-02 2015-10-20 2015-10-12
;
run;

data two;
set one;
if date1 ne . and date2 ne . and date3 ne . and date4 ne . then adt=min(date1,date2,date3,date4);
if adt =date1 or adt =date2 or adt =date3 then edur='recur';
else if adt=date4 then edur='death';&lt;BR /&gt;format adt yymmdd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Apr 2018 02:13:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-new-variable-based-on-a-condition/m-p/454332#M114828</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2018-04-16T02:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a new variable based on a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-new-variable-based-on-a-condition/m-p/454335#M114830</link>
      <description>&lt;P&gt;Look at the example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   a1 = 10;
   a2 = 5;
   a3 = .;
   y = min(a1,a2,a3);
   put y =;
   if whichN(y, a1,a2,a3) then xx ='recur';
   put xx =;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Apr 2018 03:11:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-new-variable-based-on-a-condition/m-p/454335#M114830</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2018-04-16T03:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a new variable based on a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-new-variable-based-on-a-condition/m-p/454337#M114832</link>
      <description>&lt;P&gt;COALESCE() can come in handy.&lt;/P&gt;
&lt;P&gt;Read through the function list, the best&amp;nbsp;way to know what options you have&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Apr 2018 03:16:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-new-variable-based-on-a-condition/m-p/454337#M114832</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-16T03:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a new variable based on a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-new-variable-based-on-a-condition/m-p/454339#M114834</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data two;
set one;
if cmiss(of date:) = 0 then
    edur = choosec(whichn(min(of date:), of date:),"recur","recur","recur","death");
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Apr 2018 03:33:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-new-variable-based-on-a-condition/m-p/454339#M114834</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-04-16T03:33:05Z</dc:date>
    </item>
  </channel>
</rss>

