when we have a charecter variable which has values like shown below:
0,1,2,3,4, MISSING(word)
HOW DOES IT SORT??????
i am getting the followwing order:
0
1
2
3
4
MISSING
Is there any way we can do :
MISSING
0
1
2
3
4
Thanks
You can specify a COLLATING SEQUENCE in proc sort that would do that. But you will have to make it.
Or a translation table Proc Trantab gets you started.
Personally, I wouldn't have made them character if I wan'ted them to sort that way as Missing, as a numeric, comes first, especially if all the values concerned except MISSING are number values. Then us a FORMAT to display the text if that's important.
What technique are you using to perform the sort? PROC SORT? PROC SQL? Something else? What platform are you running SAS on?
I was trying to acheive this in PROC REPORT...
Thanks
The quickest way would be to recode the variable to numeric.
You can specify a COLLATING SEQUENCE in proc sort that would do that. But you will have to make it.
Or a translation table Proc Trantab gets you started.
Personally, I wouldn't have made them character if I wan'ted them to sort that way as Missing, as a numeric, comes first, especially if all the values concerned except MISSING are number values. Then us a FORMAT to display the text if that's important.
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.
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.