BookmarkSubscribeRSS Feed
cbarks
Calcite | Level 5

Hi I am trying to create a report from a sorted dataset ( Grp_Order - Ascending & Total_Paid - Descending).  The only parts that are sorted correctly are the odd # breaks.  I tried variations of order = internal, order = data on the sorted variables.  Here is the code.

 

proc report data=WORK.UTILIZATION_DATA_ORDER nowd

style(header) =

[just = left

font_face = calibri

font_size = 3

foreground = white

background = teal

protectspecialchars=off] ;

column Groupm Service_Category CHARGE_AMOUNT DISALLOW_AMOUNT ALLOWED_AMOUNT DISCOUNT_AMOUNT BENEFIT_AMOUNT DEDUCTIBLE_AMOUNT COPAY_AMOUNT COB_AMOUNT COINSURANCE_AMOUNT TOTAL_PAID Paid_Count Discount_Percent;

WHERE Current_Period = 'X';

define Groupm / order ORDER=data noprint;

define Service_Category / order ORDER=data 'Service Category' style(column)=[asis=on] missing style={just=l vjust =b };

break after Groupm / ol summarize page;

rbreak before / summarize;

compute Service_Category;

if _break_='_RBREAK_' then do;

Service_Category='Grand Total';

call define(_row_, 'style', 'style=[font_weight=bold color = white background = grey]');

end;

else if upcase(_break_)="GROUPM" then do;

Service_Category=Groupm;

call define(_row_, 'style', 'style=[font_weight=bold color = white background = grey]');

end;

else Service_Category = ' ' || Service_Category;

endcomp;

 

define CHARGE_AMOUNT / analysis SUM 'Charges' format=DOLLAR16.0 missing style={just=c vjust=b};

define DISALLOW_AMOUNT / analysis SUM 'Disallowed' format=DOLLAR16.0 missing style={just=c vjust=b};

define ALLOWED_AMOUNT / analysis SUM 'Allowed' format=DOLLAR16.0 missing style={just=c vjust=b};

define DISCOUNT_AMOUNT / analysis SUM 'Discount' format=DOLLAR16.0 missing style={just=c vjust=b};

define BENEFIT_AMOUNT / analysis SUM 'Benefit' format=DOLLAR16.0 missing style={just=c vjust=b};

define DEDUCTIBLE_AMOUNT / analysis SUM 'Deductible' format=DOLLAR16.0 missing style={just=c vjust=b};

define COPAY_AMOUNT / analysis SUM 'Co-Pay' format=DOLLAR16.0 missing style={just=c vjust=b};

define COB_AMOUNT / analysis SUM 'COB' format=DOLLAR16.0 missing style={just=c vjust=b};

define COINSURANCE_AMOUNT / analysis SUM 'Coinsurance' format=DOLLAR16.0 missing style={just=c vjust=b};

define TOTAL_PAID / analysis SUM 'Plan Payment' order=data format=DOLLAR16.0 missing style={just=c vjust=b};

define Paid_Count / analysis SUM 'Paid Count' format=Comma14.0 missing style={just=c vjust=b};

define Discount_Percent / computed 'Disc. %' format=PERCENT7.1 missing style={just=c vjust=b};

compute Discount_Percent;

Discount_Percent= DISCOUNT_AMOUNT.sum / ALLOWED_AMOUNT.sum;

endcomp;

 

run;

quit;

 

Appreciate any help...thanks in advance..

2 REPLIES 2
mkeintz
PROC Star

Please show us a sample of the result, pointing out the part which is not wanted.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
cbarks
Calcite | Level 5

On the attached, page 1 is sorted by plan payment (Total_Paid) in descending order.  But page 2 is not.  Page 3 is sorted correctly, but page 4 is not. 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1287 views
  • 0 likes
  • 2 in conversation