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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 846 views
  • 0 likes
  • 3 in conversation