<?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: Why isn't my If-Then/DO Expression not sorting the right data for each table? in Programming 1 and 2</title>
    <link>https://communities.sas.com/t5/Programming-1-and-2/Why-isn-t-my-If-Then-DO-Expression-not-sorting-the-right-data/m-p/630773#M447</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/315861"&gt;@brianI1&lt;/a&gt;&amp;nbsp; I think your problem is the incorrect syntax&lt;/P&gt;
&lt;P&gt;Correct one is&amp;nbsp;&lt;STRONG&gt; output parks;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See if the below works&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data parks monuments;
 set "&amp;amp;path/np_summary";
 where type in ('NM', 'NP');
 Campers=sum (OtherCamping, TentCampers, RVCampers, BackcountryCampers);
 format Campers comma17.;
 length ParkType $ 8;
 if type='NP' then do;
  ParkType='Park';
  output parks;
 end;
 else do;
  Parktype='Monument';
  output monuments;
 end;
 keep Reg ParkName DayVisits OtherLodging Campers ParkType;
run;

 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And here,&lt;CODE class=" language-sas"&gt;set "&amp;amp;path/np_summary";&lt;/CODE&gt; are you trying to resolve to a physical name rather than&amp;nbsp; a logical name? This seemingly complicates reading ease.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Mar 2020 23:35:53 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-03-09T23:35:53Z</dc:date>
    <item>
      <title>Why isn't my If-Then/DO Expression not sorting the right data for each table?</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/Why-isn-t-my-If-Then-DO-Expression-not-sorting-the-right-data/m-p/630771#M446</link>
      <description>&lt;P&gt;My syntax is word for word what is used for the solution however my output data doesn't separate the "Park" and Monument" rows. Both tables have Park and Monument. Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;data parks monuments;&lt;BR /&gt;&amp;nbsp;set"&amp;amp;path/np_summary";&lt;BR /&gt;&amp;nbsp;where type in ('NM', 'NP');&lt;BR /&gt;&amp;nbsp;Campers=sum (OtherCamping, TentCampers, RVCampers, BackcountryCampers);&lt;BR /&gt;&amp;nbsp;format Campers comma17.;&lt;BR /&gt;&amp;nbsp;length ParkType $ 8;&lt;BR /&gt;&amp;nbsp;if type='NP' then do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;ParkType='Park';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;output=parks;&lt;BR /&gt;&amp;nbsp;end;&lt;BR /&gt;&amp;nbsp;else do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;Parktype='Monument';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;output=monuments;&lt;BR /&gt;&amp;nbsp;end;&lt;BR /&gt;&amp;nbsp;keep Reg ParkName DayVisits OtherLodging Campers ParkType;&lt;BR /&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 23:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/Why-isn-t-my-If-Then-DO-Expression-not-sorting-the-right-data/m-p/630771#M446</guid>
      <dc:creator>brianI1</dc:creator>
      <dc:date>2020-03-09T23:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't my If-Then/DO Expression not sorting the right data for each table?</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/Why-isn-t-my-If-Then-DO-Expression-not-sorting-the-right-data/m-p/630773#M447</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/315861"&gt;@brianI1&lt;/a&gt;&amp;nbsp; I think your problem is the incorrect syntax&lt;/P&gt;
&lt;P&gt;Correct one is&amp;nbsp;&lt;STRONG&gt; output parks;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See if the below works&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data parks monuments;
 set "&amp;amp;path/np_summary";
 where type in ('NM', 'NP');
 Campers=sum (OtherCamping, TentCampers, RVCampers, BackcountryCampers);
 format Campers comma17.;
 length ParkType $ 8;
 if type='NP' then do;
  ParkType='Park';
  output parks;
 end;
 else do;
  Parktype='Monument';
  output monuments;
 end;
 keep Reg ParkName DayVisits OtherLodging Campers ParkType;
run;

 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And here,&lt;CODE class=" language-sas"&gt;set "&amp;amp;path/np_summary";&lt;/CODE&gt; are you trying to resolve to a physical name rather than&amp;nbsp; a logical name? This seemingly complicates reading ease.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 23:35:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/Why-isn-t-my-If-Then-DO-Expression-not-sorting-the-right-data/m-p/630773#M447</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-03-09T23:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't my If-Then/DO Expression not sorting the right data for each table?</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/Why-isn-t-my-If-Then-DO-Expression-not-sorting-the-right-data/m-p/630779#M448</link>
      <description>&lt;P&gt;You probably wanted OUTPUT statements instead of assignment statements.&amp;nbsp; Didn't you see the note in the log about the uninitialized variables PARKS and MONUMENTS that these two assignment statements are reading from.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  output=parks;
  output=monuments;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you didn't have the KEEP statement you would have both of those and the variable OUTPUT also in your dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 00:18:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/Why-isn-t-my-If-Then-DO-Expression-not-sorting-the-right-data/m-p/630779#M448</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-10T00:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't my If-Then/DO Expression not sorting the right data for each table?</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/Why-isn-t-my-If-Then-DO-Expression-not-sorting-the-right-data/m-p/630808#M449</link>
      <description>&lt;P&gt;Show the solution you are referring to (preferably with a link to it), and we can show you what went wrong.&lt;/P&gt;
&lt;P&gt;The log will alert you to possible problem locations, and you may have misunderstood the syntax of the output statement.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 07:43:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/Why-isn-t-my-If-Then-DO-Expression-not-sorting-the-right-data/m-p/630808#M449</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-10T07:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't my If-Then/DO Expression not sorting the right data for each table?</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/Why-isn-t-my-If-Then-DO-Expression-not-sorting-the-right-data/m-p/630947#M450</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;, That was exactly my mistake. Just little things like that can make a world of difference. The pathfile for "set" is just for training.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 15:06:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/Why-isn-t-my-If-Then-DO-Expression-not-sorting-the-right-data/m-p/630947#M450</guid>
      <dc:creator>brianI1</dc:creator>
      <dc:date>2020-03-10T15:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't my If-Then/DO Expression not sorting the right data for each table?</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/Why-isn-t-my-If-Then-DO-Expression-not-sorting-the-right-data/m-p/630948#M451</link>
      <description>&lt;P&gt;Exactly! Thank you for your response!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 15:07:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/Why-isn-t-my-If-Then-DO-Expression-not-sorting-the-right-data/m-p/630948#M451</guid>
      <dc:creator>brianI1</dc:creator>
      <dc:date>2020-03-10T15:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Why isn't my If-Then/DO Expression not sorting the right data for each table?</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/Why-isn-t-my-If-Then-DO-Expression-not-sorting-the-right-data/m-p/630949#M452</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;Thank you for your response. The mistake was the output statement.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 15:08:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/Why-isn-t-my-If-Then-DO-Expression-not-sorting-the-right-data/m-p/630949#M452</guid>
      <dc:creator>brianI1</dc:creator>
      <dc:date>2020-03-10T15:08:38Z</dc:date>
    </item>
  </channel>
</rss>

