BookmarkSubscribeRSS Feed
marieK
Obsidian | Level 7
Hi,

in my output-table i would like to order my value-names like i want (i.e. i have a frequency-table and the values "yes" , "no", "no answer" and "missings"). if i sort these values i get an output like that:

missings: 10
no: 266
no answer: 70
yes: 599

but i would like to have a table like that:

no: 266
yes: 599
no answer: 70
missings: 10


any idea how i can sort my table output that way??

thank you in advance, marie
3 REPLIES 3
Flip
Fluorite | Level 6
Create a surogate sort variable such that
4 : missings
1 : no
3 : no answer
2 : yes

Sort on that var, but do not diaplay it.
DanielSantos
Barite | Level 11
Another way, would be to create a format (with the desired ordered values, then perform a formatted sort through SQL.

proc sql;
create table b as select * from a order by put(a, $myformat.);
quit;

More about creating SAS formats here:
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a002473464.htm

Cheers from Portugal.

Daniel Santos @ www.cgd.pt.
marieK
Obsidian | Level 7
Thank u very much for your answers!! I'll try it out!

cheers marie

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1395 views
  • 0 likes
  • 3 in conversation