<?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 observations in reverse order. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-print-observations-in-reverse-order/m-p/553163#M9330</link>
    <description>&lt;P&gt;Reverse the order of data without sorting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset –&lt;BR /&gt;var1&lt;BR /&gt;7&lt;BR /&gt;1&lt;BR /&gt;6&lt;BR /&gt;4&lt;BR /&gt;3&lt;BR /&gt;8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output –&lt;BR /&gt;var1&lt;BR /&gt;8&lt;BR /&gt;3&lt;BR /&gt;4&lt;BR /&gt;6&lt;BR /&gt;1&lt;BR /&gt;7&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Please suggest code to print above output with data statement not with sql.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jai&lt;/P&gt;</description>
    <pubDate>Tue, 23 Apr 2019 10:22:58 GMT</pubDate>
    <dc:creator>jaiganesh</dc:creator>
    <dc:date>2019-04-23T10:22:58Z</dc:date>
    <item>
      <title>How to print observations in reverse order.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-print-observations-in-reverse-order/m-p/553163#M9330</link>
      <description>&lt;P&gt;Reverse the order of data without sorting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset –&lt;BR /&gt;var1&lt;BR /&gt;7&lt;BR /&gt;1&lt;BR /&gt;6&lt;BR /&gt;4&lt;BR /&gt;3&lt;BR /&gt;8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output –&lt;BR /&gt;var1&lt;BR /&gt;8&lt;BR /&gt;3&lt;BR /&gt;4&lt;BR /&gt;6&lt;BR /&gt;1&lt;BR /&gt;7&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Please suggest code to print above output with data statement not with sql.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jai&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 10:22:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-print-observations-in-reverse-order/m-p/553163#M9330</guid>
      <dc:creator>jaiganesh</dc:creator>
      <dc:date>2019-04-23T10:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to print observations in reverse order.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-print-observations-in-reverse-order/m-p/553168#M9332</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;Please suggest code to print above output with data statement not with sql.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about using PROC SORT????&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    seq=_n_;
run;
proc sort data=want;
    by descending seq;
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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 10:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-print-observations-in-reverse-order/m-p/553168#M9332</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-23T10:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to print observations in reverse order.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-print-observations-in-reverse-order/m-p/553170#M9333</link>
      <description>&lt;P&gt;Or use the POINT= option of the SET statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
file print;
put 'var1';
do i=n to 1 by -1;
  set have nobs=n point=i;
  put var1;
end;
stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 11:04:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-print-observations-in-reverse-order/m-p/553170#M9333</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-04-23T11:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to print observations in reverse order.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-print-observations-in-reverse-order/m-p/553305#M9351</link>
      <description>&lt;P&gt;Of course when &lt;STRONG&gt;genie_reinhard &lt;/STRONG&gt;has answered, others can retire but so bored today&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input var1;
cards;
7
1
6
4
3
8
;

data _null_;
if _n_=1 then do;
   dcl hash H (ordered: "d") ;
   h.definekey  ("_n_") ;
   h.definedata ("var1") ;
   h.definedone () ;
  end;
  set have end=lr;
  rc=h.add();
if lr then h.output(dataset:'want');
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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 15:13:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-print-observations-in-reverse-order/m-p/553305#M9351</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-04-23T15:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to print observations in reverse order.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-print-observations-in-reverse-order/m-p/553320#M9354</link>
      <description>&lt;P&gt;And likely not to be terribly efficient or generalizable but&lt;/P&gt;
&lt;PRE&gt;data have;
input var1;
datalines;
7
1
6
4
3
8
;
run;

proc transpose data=have out=want;
run;

data _null_;
   set want;
   file print;
   array c col: ;
   do i= dim(c) to 1 by -1;
     put c[i];
   end;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Apr 2019 15:51:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-print-observations-in-reverse-order/m-p/553320#M9354</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-23T15:51:27Z</dc:date>
    </item>
  </channel>
</rss>

