I am struggling to sort my catplot for my variable CCR_adjusted.
I know that with catplot I can sort by ascending and descending, but I want a certain order (Finance practice): CC, CCC-, CCC, CCC+, B-, B, B+, BB-, BB, BB+, BBB-, BBB, BBB+ (if this is not within the data set then still show the label).
I read that I may have to do it with egen = group() and define my variables. But the problem is that the data values of my variable are the different labels. Do I have to create new variables for each of the possible values and plot them then? How would that look like?
My code:
Code:
catplot CCR_adjusted, percent var1opts(sort(1) descending) recast(bar)
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str9 CCR_adjusted "B" "BB-" "B+" "B" "B" "B" "B+" "B" "B" "B-" "B-" "B-" "B" "B" "B" "BB-" "B" "B" "B" "B" "B" "CCC+" "B" "B+" "B+" "B" "B" "B" "B" "BB-" "BB-" "B+" "BB+" "B+" "BB+" "B+" "B" "B+" "BB-" "B" "B" "B" "B" "B+" "B+" "BB-" "B" "B-" "BB" "BB-" "B-" "B" "BB-" "B" "BB-" "B" "BB-" "B" "B" "BB+" "B" "B+" "BB-" "BB+" "B+" "B" "B-" "B+" "BB-" "BB" "B-" "B-" "B" "B" "B+" "B" "BB" "BB" "B" "B+" "BB" "B" "B+" "B+" "B+" "BB" "BB+" "BBB-" "BB-" "B" "B" "B" "BB+" "B" "BB-" "BB+" "BBB-" "B" "BB" "B" end
0 Response to Catplot - manual sort
Post a Comment