That worked as far as reordering my rows, but with the way I have my data sorted, it didn't work out exactly how I wanted. Now my columns are unsorted. Let me better explain my code, because that is probably causing the difference.
My scores are actually ranges of scores, so my raw data was a range of scores from say, 301-400 for score1 and 201-900 for score2. Each score combination may occur once, multiple times or not at all, so I have grouped them into ranges.
Also with each score-range combination, there is one of three events tied to it: A, B or C. I want to create three two-way frequency tables, one for each event. So here is a summary of my code:
data raw;
set refined;
/*
if statements here to group into ranges
*/
run;
proc sort data=refined(keep=score1 score2 event) out=sort;
by event descending score1 score2;
run;
proc freq data=sort order=data;
tables score1*score2 / nocol norow;
by event;
run;
I now have 3 freq tables, with score1 in descending order, but for some reason, score2 is unsorted. I'm sure it is because of the way the data is sorted, but I don't know how to tell SAS to sort both rows and columns. I am pretty sure that I need to sort by event first because that is how SAS determines how to separate the 3 tables, so that might be why the order=data isn't working exactly how I want it to. Any ideas?
Also, is there a way to suppress the 0's in the cells with no count and just show those cells to be blank?
Thanks!
Message was edited by: TheWolff