<?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: If X then do y with practice p201p03 in Programming 1 and 2</title>
    <link>https://communities.sas.com/t5/Programming-1-and-2/If-X-then-do-y-with-practice-p201p03/m-p/708261#M681</link>
    <description>thanks for your kind answer</description>
    <pubDate>Sat, 26 Dec 2020 10:07:27 GMT</pubDate>
    <dc:creator>maximek</dc:creator>
    <dc:date>2020-12-26T10:07:27Z</dc:date>
    <item>
      <title>If X then do y with practice p201p03</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/If-X-then-do-y-with-practice-p201p03/m-p/703852#M674</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the first level of the practice dedicated to the first lesson of the second course, it is requested to create three tables : monument, park and other with the following conditions :&lt;/P&gt;&lt;P&gt;Drop Parktype for monument and park&lt;/P&gt;&lt;P&gt;Drop Region for the three tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The correct solution is :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data monument(drop=ParkType) park(drop=ParkType) other; 
    set pg2.np_yearlytraffic;
    if ParkType = 'National Monument' then output monument;
    else if ParkType = 'National Park' then output park;
    else output other;
    drop Region;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But I tried to do it with "if then do" statements :&lt;/P&gt;&lt;PRE&gt;data monument park other;
	set pg2.np_yearlytraffic;
	drop Region;
	if ParkType = 'National Monument' then 
	do;
	drop Parktype;
	output monument;
	end;
	else if ParkType = 'National Park' then do;
	drop Parktype;
	output park;
	end;
	else output other;

run;&lt;/PRE&gt;&lt;P&gt;The issue being that now, the table other does not contain "Parktype" and I don't understand why is that so.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Sat, 05 Dec 2020 12:16:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/If-X-then-do-y-with-practice-p201p03/m-p/703852#M674</guid>
      <dc:creator>maximek</dc:creator>
      <dc:date>2020-12-05T12:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: If X then do y with practice p201p03</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/If-X-then-do-y-with-practice-p201p03/m-p/704235#M675</link>
      <description>Hi:&lt;BR /&gt;  Please go back and review the material in Programming 2 on the DROP and KEEP statement. These statements cannot be executed conditionally. They are COMPILE time statements. &lt;BR /&gt;Cynthia</description>
      <pubDate>Mon, 07 Dec 2020 18:22:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/If-X-then-do-y-with-practice-p201p03/m-p/704235#M675</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2020-12-07T18:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: If X then do y with practice p201p03</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/If-X-then-do-y-with-practice-p201p03/m-p/708261#M681</link>
      <description>thanks for your kind answer</description>
      <pubDate>Sat, 26 Dec 2020 10:07:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/If-X-then-do-y-with-practice-p201p03/m-p/708261#M681</guid>
      <dc:creator>maximek</dc:creator>
      <dc:date>2020-12-26T10:07:27Z</dc:date>
    </item>
  </channel>
</rss>

