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;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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: