hello, I'm having trouble sorting and collapsing my data in a proc report. I have created a sample dataset. Prior programming has replaced any frequency percent <3.9% as 'other' in the drugcombination variable. In the report, I want to do the following: 1) to collapse the 'other' category within each combogroup. 2) to place 'Other' combogroup at the end and 'other' drugcombinations at the end within combogroup. I believe I have done this with the dummy sort variables I have created. 3) I want to put the drugcombinationchemo in an order based on the descending value of the percent column (while still keeping 'other' at the end if possible). I have tried various ways to show the percent column in descending order plus collapsing 'other' and nothing seems to work. Do I need to do a proc tabulate to sum the 'other' values and then do proc report? I am getting the following output which is not accomplishing item 1 and item 3 above. SAS Output Combination Group Combination Percent Dar Mono daratumumab 100.00 IMiD Mono lenalidomide 94.29 pomalidomide 1.43 thalidomide 4.29 PI Mono bortezomib 93.88 carfilzomib 5.94 other 0.17 PI-Cyclo± bortezomib - cyclophosphamide 99.25 carfilzomib - cyclophosphamide 0.75 PI-Dox± bortezomib - doxorubicin lipos 100.00 PI-IMiD bortezomib - lenalidomide 98.36 bortezomib - pomalidomide 1.09 other 0.55 Other bortezomib - daratumumab 17.24 cyclophosphamide 10.34 elotuzumab 13.79 elotuzumab - lenalidomide 6.90 investigational drugs 34.48 other 3.45 code: DATA have ; infile datalines delimiter=',' ; format combogroup $12. DrugCombinationChemo $30. Percent 8.2 drugsort 8.0 drugsort2 8.0 ; input combogroup $ DrugCombinationChemo $ Percent drugsort drugsort2 ; datalines ; Dar Mono,daratumumab,100,0,0 IMiD Mono,lenalidomide,94.2857142857143,0,0 IMiD Mono,thalidomide,4.28571428571429,0,0 IMiD Mono,pomalidomide,1.42857142857143,0,0 Other,investigational drugs,34.4827586206897,1,0 Other,bortezomib - daratumumab,17.2413793103448,1,0 Other,elotuzumab,13.7931034482759,1,0 Other,cyclophosphamide,10.3448275862069,1,0 Other,elotuzumab - lenalidomide,6.89655172413793,1,0 Other,other,3.44827586206897,1,1 Other,other,3.44827586206897,1,1 Other,other,3.44827586206897,1,1 Other,other,3.44827586206897,1,1 Other,other,3.44827586206897,1,1 PI Mono,bortezomib,93.8811188811189,0,0 PI Mono,carfilzomib,5.94405594405594,0,0 PI Mono,other,0.174825174825175,0,1 PI-Cyclo±,bortezomib - cyclophosphamide,99.2481203007519,0,0 PI-Cyclo±,carfilzomib - cyclophosphamide,0.75187969924812,0,0 PI-Dox±,bortezomib - doxorubicin liposomal,100,0,0 PI-IMiD,bortezomib - lenalidomide,98.3606557377049,0,0 PI-IMiD,bortezomib - pomalidomide,1.09289617486339,0,0 PI-IMiD,other,0.546448087431694,0,1 ; run; proc print; run; proc sort data=have ; by drugsort combogroup drugsort2 descending percent ; run; proc print; run; proc report data=have nowd style(report)=[background=ltgray ] style(column)=[background=gwh] style(header)=[background=ltgray foreground=white]; column drugsort combogroup drugcombinationchemo percent ; define drugsort /order order=internal noprint; define combogroup /order order=data group 'Combination Group' ; define percent /analysis sum order order=internal; define drugcombinationchemo /group 'Combination' ; run;
... View more