The SAS Output Delivery System and reporting techniques

ods and proc tabulate report

Reply
Occasional Contributor
Posts: 19

ods and proc tabulate report

Hi Cynthia/All

Please guide me how can I keep the value of total column for a particular indicator as a blank cell in proc tabulate. As given below i have enclosed a the requirement sheet where we have to put blank cell in a total column for a particular indicators only and rest should come  with the sum of all months.  I have attached a small Data set and sas code. Anyone can reply me with correct solution.print screen.png

Attachment
SAS Super FREQ
Posts: 8,868

Re: ods and proc tabulate report

Hi:

  With TABULATE, you cannot suppress a cell, such as you describe, but with PROC REPORT, you can suppress or alter the data in a cell. Please see this example:

example_with_proc_report.png

 

Produced by this program:


ods msoffice2k file='c:\temp\all_india_mso.html' style=styles.normal;
 

%let finyear=2015;
%let update=9/13/2015;
TITLE1   FONT="Trebuchet MS" height=11pt color=black " Data ItemWise Report for - All India ";
TITLE2   FONT="Trebuchet MS" height=11pt color=black " Provisional Figures for - &Finyear ";
TITLE3   FONT="Trebuchet MS" height=11pt color=black " Status As On: &Update ";


** sort by monthid_n then use order=data in PROC REPORT;
** to make month values sort in desired order;
proc sort data=work.data2;
  by statename_v misconsheadercode_v misconsheadername_v monthid_n;
run;

options missing=' ';
proc report data=WORK.DATA2 nowd missing;
  column STATENAME_V MISCONSHEADERCODE_V MISCONSHEADERNAME_V DETAIL  value_n,MONTHNAME_V value_n=vtot;
  define STATENAME_V / 'State' group
         style(header)=Header{color=vigb FONT_FACE='Trebuchet MS'}
         style(column)=Header{color=vigb FONT_FACE='Trebuchet MS'};
  define misconsheadercode_v / ' 'group 
         style(column)=Header{color=vigb FONT_FACE='Trebuchet MS'};
  define misconsheadername_v / ' 'group 
         style(column)=Header{color=vigb FONT_FACE='Trebuchet MS'};
  define detail / group  ' ' style(column)=Header{color=vigb FONT_FACE='Trebuchet MS'};
  define MONTHNAME_V / across ' ' order=data 
         style(header)=Header{color=vigb FONT_FACE='Trebuchet MS'};
  define value_n / sum ' '
         style(header)=Header{color=vigb FONT_FACE='Trebuchet MS'};
  define vtot / 'Total'
         style(header)=Header{color=vigb FONT_FACE='Trebuchet MS'};
  compute vtot;
    if misconsheadercode_v in ( '1.1.1', '1.3', '1.6.1') then vtot = .;
  endcomp;
run;

ods _all_ close;

 

 

cynthia

Ask a Question
Discussion stats
  • 1 reply
  • 383 views
  • 0 likes
  • 2 in conversation