<?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 Output two tables with different columns from one dataset in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Output-two-tables-with-different-columns-from-one-dataset/m-p/794287#M32819</link>
    <description>&lt;P&gt;Hello, I am a SAS beginner and encounter a question as follows:&lt;/P&gt;&lt;P&gt;I want to output two tables(parks, monuments) from one dataset, say, pg1.np_summary; While in output table parks I wanna keep variables Reg ParkName DayVisits; in output table monuments I wanna keep variables&amp;nbsp; Reg.&amp;nbsp; The following is my programming:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data parks monuments;&lt;/P&gt;&lt;P&gt;set pg1.np_summary;&lt;/P&gt;&lt;P&gt;where type in ('NM','NP');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if type='NP' then do;&lt;/P&gt;&lt;P&gt;output parks;&lt;/P&gt;&lt;P&gt;keep&amp;nbsp;&amp;nbsp;Reg ParkName DayVisits;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;else do;&lt;/P&gt;&lt;P&gt;output monuments;&lt;/P&gt;&lt;P&gt;keep&amp;nbsp;&amp;nbsp;Reg ;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I found the two output tables end up with having only one variable specified(Reg). May I know how to program that in order to have two output tables with different columns?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Feb 2022 17:09:30 GMT</pubDate>
    <dc:creator>Eathonhua</dc:creator>
    <dc:date>2022-02-03T17:09:30Z</dc:date>
    <item>
      <title>Output two tables with different columns from one dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-two-tables-with-different-columns-from-one-dataset/m-p/794287#M32819</link>
      <description>&lt;P&gt;Hello, I am a SAS beginner and encounter a question as follows:&lt;/P&gt;&lt;P&gt;I want to output two tables(parks, monuments) from one dataset, say, pg1.np_summary; While in output table parks I wanna keep variables Reg ParkName DayVisits; in output table monuments I wanna keep variables&amp;nbsp; Reg.&amp;nbsp; The following is my programming:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data parks monuments;&lt;/P&gt;&lt;P&gt;set pg1.np_summary;&lt;/P&gt;&lt;P&gt;where type in ('NM','NP');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if type='NP' then do;&lt;/P&gt;&lt;P&gt;output parks;&lt;/P&gt;&lt;P&gt;keep&amp;nbsp;&amp;nbsp;Reg ParkName DayVisits;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;else do;&lt;/P&gt;&lt;P&gt;output monuments;&lt;/P&gt;&lt;P&gt;keep&amp;nbsp;&amp;nbsp;Reg ;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I found the two output tables end up with having only one variable specified(Reg). May I know how to program that in order to have two output tables with different columns?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 17:09:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-two-tables-with-different-columns-from-one-dataset/m-p/794287#M32819</guid>
      <dc:creator>Eathonhua</dc:creator>
      <dc:date>2022-02-03T17:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: Output two tables with different columns from one dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-two-tables-with-different-columns-from-one-dataset/m-p/794288#M32820</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data parks(keep=reg parkname dayvisits) monuments(keep=reg);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Feb 2022 17:11:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-two-tables-with-different-columns-from-one-dataset/m-p/794288#M32820</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-02-03T17:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Output two tables with different columns from one dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-two-tables-with-different-columns-from-one-dataset/m-p/794290#M32822</link>
      <description>&lt;P&gt;KEEP &lt;STRONG&gt;statements&lt;/STRONG&gt; apply to all output data sets on the DATA statement.&lt;/P&gt;
&lt;P&gt;KEEP &lt;STRONG&gt;data set options&lt;/STRONG&gt; apply to only the data set referenced.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You're using a KEEP statement in the data step but need to use a data set option instead.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;provided the code for that solution.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/415313"&gt;@Eathonhua&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello, I am a SAS beginner and encounter a question as follows:&lt;/P&gt;
&lt;P&gt;I want to output two tables(parks, monuments) from one dataset, say, pg1.np_summary; While in output table parks I wanna keep variables Reg ParkName DayVisits; in output table monuments I wanna keep variables&amp;nbsp; Reg.&amp;nbsp; The following is my programming:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data parks monuments;&lt;/P&gt;
&lt;P&gt;set pg1.np_summary;&lt;/P&gt;
&lt;P&gt;where type in ('NM','NP');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if type='NP' then do;&lt;/P&gt;
&lt;P&gt;output parks;&lt;/P&gt;
&lt;P&gt;keep&amp;nbsp;&amp;nbsp;Reg ParkName DayVisits;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;else do;&lt;/P&gt;
&lt;P&gt;output monuments;&lt;/P&gt;
&lt;P&gt;keep&amp;nbsp;&amp;nbsp;Reg ;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I found the two output tables end up with having only one variable specified(Reg). May I know how to program that in order to have two output tables with different columns?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 17:14:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-two-tables-with-different-columns-from-one-dataset/m-p/794290#M32822</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-02-03T17:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: Output two tables with different columns from one dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-two-tables-with-different-columns-from-one-dataset/m-p/794376#M32850</link>
      <description>Thanks!</description>
      <pubDate>Thu, 03 Feb 2022 23:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-two-tables-with-different-columns-from-one-dataset/m-p/794376#M32850</guid>
      <dc:creator>Eathonhua</dc:creator>
      <dc:date>2022-02-03T23:59:04Z</dc:date>
    </item>
  </channel>
</rss>

