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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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