<?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 How to print few observations with where condition in Proc Print. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-few-observations-with-where-condition-in-Proc-Print/m-p/507660#M72861</link>
    <description>&lt;P&gt;I want to show some specific obs from a dataset with Proc Print&lt;/P&gt;&lt;P&gt;Ex-- we have a dataset which contains name with different Genders.&lt;/P&gt;&lt;P&gt;Name&amp;nbsp; &amp;nbsp; &amp;nbsp;Gender&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;X&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M&lt;/P&gt;&lt;P&gt;Y&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M&lt;/P&gt;&lt;P&gt;Z&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; F&lt;/P&gt;&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to print only Gender = M obs with Proc Print, we can use Where condition.But if i don't want to print all obs but some specific number (For Ex-2 -- only x and Y not Z)&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;How to do it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Oct 2018 07:22:19 GMT</pubDate>
    <dc:creator>Vibcom</dc:creator>
    <dc:date>2018-10-26T07:22:19Z</dc:date>
    <item>
      <title>How to print few observations with where condition in Proc Print.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-few-observations-with-where-condition-in-Proc-Print/m-p/507660#M72861</link>
      <description>&lt;P&gt;I want to show some specific obs from a dataset with Proc Print&lt;/P&gt;&lt;P&gt;Ex-- we have a dataset which contains name with different Genders.&lt;/P&gt;&lt;P&gt;Name&amp;nbsp; &amp;nbsp; &amp;nbsp;Gender&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;X&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M&lt;/P&gt;&lt;P&gt;Y&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M&lt;/P&gt;&lt;P&gt;Z&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; F&lt;/P&gt;&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to print only Gender = M obs with Proc Print, we can use Where condition.But if i don't want to print all obs but some specific number (For Ex-2 -- only x and Y not Z)&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;How to do it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 07:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-few-observations-with-where-condition-in-Proc-Print/m-p/507660#M72861</guid>
      <dc:creator>Vibcom</dc:creator>
      <dc:date>2018-10-26T07:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to print few observations with where condition in Proc Print.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-few-observations-with-where-condition-in-Proc-Print/m-p/507662#M72862</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;&lt;BR /&gt; set have(where=(gender='M'));&lt;BR /&gt;run;&lt;BR /&gt;proc print data=temp (obs=2);
  var  &amp;lt;list of variables to print&amp;gt;;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Oct 2018 07:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-few-observations-with-where-condition-in-Proc-Print/m-p/507662#M72862</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-10-26T07:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to print few observations with where condition in Proc Print.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-few-observations-with-where-condition-in-Proc-Print/m-p/507677#M72863</link>
      <description>&lt;P&gt;Why not simply&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=have(where=(gender='M') obs=2);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or equivalently&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=have(obs=2);
where gender='M'; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 08:59:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-few-observations-with-where-condition-in-Proc-Print/m-p/507677#M72863</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-10-26T08:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to print few observations with where condition in Proc Print.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-few-observations-with-where-condition-in-Proc-Print/m-p/507693#M72864</link>
      <description>&lt;P&gt;Maybe you need to write down the rules an observation has to fulfil to be printed.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 10:22:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-few-observations-with-where-condition-in-Proc-Print/m-p/507693#M72864</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-10-26T10:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to print few observations with where condition in Proc Print.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-few-observations-with-where-condition-in-Proc-Print/m-p/507715#M72865</link>
      <description>&lt;P&gt;If you want the first n observations of a specific subset, it is much easier to use SQL with the OUTOBS option:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc sql outoubs=20;
  select name from have where gender='M';
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You may want to use ORDER BY to make sure you get the topmost observations, SQL does not guarantee the order otherwise.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 12:30:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-few-observations-with-where-condition-in-Proc-Print/m-p/507715#M72865</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2018-10-26T12:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to print few observations with where condition in Proc Print.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-print-few-observations-with-where-condition-in-Proc-Print/m-p/507724#M72868</link>
      <description>&lt;P&gt;Are you trying to control the number of records to print or you want to print the list of record that you wish?&lt;/P&gt;
&lt;P&gt;If you have a list where your print result need to include from then, Why not list them in where condition. Create a list of values into a macro and then later filter them in Proc print where condition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select quote(strip(name)) into:names separated by ','
from sashelp.class
where age&amp;gt;13;
quit;

proc print data=sashelp.class(where=(sex='M' and name in (&amp;amp;names.)));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 13:13:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-print-few-observations-with-where-condition-in-Proc-Print/m-p/507724#M72868</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-10-26T13:13:38Z</dc:date>
    </item>
  </channel>
</rss>

