Help using Base SAS procedures

Change collation order

Reply
Contributor
Posts: 44

Change collation order

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
Super Contributor
Posts: 359

Re: Change collation order

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.
Super Contributor
Posts: 474

Re: Change collation order

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.
Contributor
Posts: 44

Re: Change collation order

Posted in reply to DanielSantos
Thank u very much for your answers!! I'll try it out!

cheers marie
Ask a Question
Discussion stats
  • 3 replies
  • 114 views
  • 0 likes
  • 3 in conversation