And if you do NOT mind a NOTE in the log stating "NOTE: The query as specified involves ordering by an item that doesn't appear in its SELECTclause."
data have;
input var $;
cards;
1
2
A
Sr
R
Y
7
;
proc sql;
create table want as
select *
from have
order by monotonic() desc;
quit;
data have;
input var $;
cards;
1
2
A
Sr
R
Y
7
;
proc sql;
create table want(drop=rn) as
select *,monotonic() as rn
from have
order by rn desc;
quit;
And if you do NOT mind a NOTE in the log stating "NOTE: The query as specified involves ordering by an item that doesn't appear in its SELECTclause."
data have;
input var $;
cards;
1
2
A
Sr
R
Y
7
;
proc sql;
create table want as
select *
from have
order by monotonic() desc;
quit;
If your table is not very big.
data have;
input var $;
cards;
1
2
A
Sr
R
Y
7
;
data want;
do i=nobs to 1 by -1;
set have nobs=nobs point=i;
output;
end;
stop;
drop i;
run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: