Help using Base SAS procedures

Percentage in proc tabulate

Regular Contributor
Posts: 178

Percentage in proc tabulate

Proc tabulate data=exc_cnt order= data format=10. S=[cellwidth=150];

Class prog_ctgy CODEDESC;

Var gr_amt cnt_cd;

Table CODEDESC=' ' all={label='Total' S=[background = lightblue cellwidth=160]} *[STYLE=[Font_Weight=BOLD]],

prog_ctgy*(cnt_cd=''*sum='Exceptions Units' gr_amt=''*sum='Exceptions$' /** colpctn*/ )

all={label='Grand Total' S=[background = lightblue]} *[STYLE=[Font_Weight=BOLD]] *cnt_cd =' '*sum=' ' / box='Exception Codes';

TITLE 'Summary';

footnote1 &rptdate;



This code produced the dataset enclosed in the attachment.  Now I want to add a column percentage total per exception code, grouped by prg_catg.  AS you can see I used colpctn however unable to get it to work in the individual columns.  It need to be a separate measure based on gross loan amount and the number of cnt_cd, shown in the VAR section.   The yellow portion represents where I want to put the data.

Super User
Posts: 13,507

Re: Percentage in proc tabulate

Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values. shows how to create data step code from your existing data set. Then we can test code against your data and see the actual output.


For showing "highlighted change" you may be better off posting an image.



Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation