<?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: print only certain data values using _n_ in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/print-only-certain-data-values-using-n/m-p/400078#M96962</link>
    <description>&lt;P&gt;Printing and _N_ are not really related concepts. The automatic variable _N_ can be used to keep track of how many times a data step has executed the implicit loop. Printing is normally done using a proc like PROC PRINT or PROC REPORT. You could make a subset of the data using a data step that references _N_ and print that.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data to_print;
  set sashelp.class;
  if 4 &amp;lt;= _n_ &amp;lt;=10 ; 
run; 
proc print; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since you just want one continuous range of observations you could use the FIRSTOBS= and OBS= dataset options to pick which observations you want to print, but that has nothing to do with the data step automatic variable _N_.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=sashelp.class (firstobs=4 obs=10); 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 01 Oct 2017 03:00:34 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2017-10-01T03:00:34Z</dc:date>
    <item>
      <title>print only certain data values using _n_</title>
      <link>https://communities.sas.com/t5/SAS-Programming/print-only-certain-data-values-using-n/m-p/400065#M96957</link>
      <description>&lt;P&gt;I have a dataset containing 50 data values and want to print only&amp;nbsp;4th to 10th observations. How can i do this using _N_?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2017 01:16:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/print-only-certain-data-values-using-n/m-p/400065#M96957</guid>
      <dc:creator>variathu</dc:creator>
      <dc:date>2017-10-01T01:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: print only certain data values using _n_</title>
      <link>https://communities.sas.com/t5/SAS-Programming/print-only-certain-data-values-using-n/m-p/400078#M96962</link>
      <description>&lt;P&gt;Printing and _N_ are not really related concepts. The automatic variable _N_ can be used to keep track of how many times a data step has executed the implicit loop. Printing is normally done using a proc like PROC PRINT or PROC REPORT. You could make a subset of the data using a data step that references _N_ and print that.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data to_print;
  set sashelp.class;
  if 4 &amp;lt;= _n_ &amp;lt;=10 ; 
run; 
proc print; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since you just want one continuous range of observations you could use the FIRSTOBS= and OBS= dataset options to pick which observations you want to print, but that has nothing to do with the data step automatic variable _N_.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=sashelp.class (firstobs=4 obs=10); 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2017 03:00:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/print-only-certain-data-values-using-n/m-p/400078#M96962</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-10-01T03:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: print only certain data values using _n_</title>
      <link>https://communities.sas.com/t5/SAS-Programming/print-only-certain-data-values-using-n/m-p/400170#M97011</link>
      <description>&lt;P&gt;data want;&lt;BR /&gt;do p=4 to 10;&lt;BR /&gt;set sashelp.class point=p;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;stop;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2017 22:06:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/print-only-certain-data-values-using-n/m-p/400170#M97011</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-10-01T22:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: print only certain data values using _n_</title>
      <link>https://communities.sas.com/t5/SAS-Programming/print-only-certain-data-values-using-n/m-p/400172#M97012</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/165081"&gt;@variathu&lt;/a&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=sashelp.class (firstobs=4 obs=10);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 252px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15525iD0ADD82F4CECB5F7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2017 22:26:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/print-only-certain-data-values-using-n/m-p/400172#M97012</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-10-01T22:26:03Z</dc:date>
    </item>
  </channel>
</rss>

