Hello
Please see this code.
I want to do some changes to output and don;t know how to do it in proc report code.
I want to add global total for following grades:a.0,b.1-6 ,c.7-10,d.11 (without grade e.12)
Data TBl;
INPUT grade $ Model $ Obligo;
Cards;
a.0 a 10
a.0 b 20
b.1-6 a 30
c.7-10 a 40
d.11 a 50
d.11 b 60
e.12 a 70
e.12 b 80
;
Run;
libname proclib 'SAS-library';
options nodate pageno=1 linesize=64 pagesize=60
fmtsearch=(proclib);
proc report data=TBl nowd headline headskip;
column grade Model Obligo ;
define grade / group
'Grade';
define Model / group
'Model';
define Obligo / analysis sum
format=comma10.
'Ob';
/*total after each groupkCat*/
break after grade / ol
summarize
suppress
skip;
/*global total*/
rbreak after / summarize;
compute after;
type = 'Total';
endcomp;
run;
Yes.
I want to get subtotal without e.12 and in the row after getting information of e.12 and in row after get total of all(included e.12)
You may want to try using a multilabel format. Note the (multilabel) option on the VALUE statement and the MLF option on the DEFINE statement. Unless you are writing to the LISTING destination, you can also eliminate a number of REPORT options e.g. HEADLINE, HEADSKIP, SKIP, OL
Data TBl;
INPUT grade $ Model $ Obligo;
Cards;
a.0 a 10
a.0 b 20
b.1-6 a 30
c.7-10 a 40
d.11 a 50
d.11 b 60
e.12 a 70
e.12 b 80
;
Run;
proc format;
value $grade (multilabel)
'a.0' = 'Primary'
'b.1-6' = 'Primary'
'c.7-10' = 'Primary'
'd.11' = 'Primary'
'a.0' = 'Secondary'
'b.1-6' = 'Secondary'
'c.7-10' = 'Secondary'
'd.11' = 'Secondary'
'e.12' = 'Secondary';
run;
/*libname proclib 'SAS-library';*/
/*options nodate pageno=1 linesize=64 pagesize=60*/
/*fmtsearch=(proclib);*/
proc report data=TBl;
column grade=ggroup grade Model Obligo ;
define ggroup / group 'Grade Group' f=$grade. mlf;
define grade / group 'Grade';
define Model / group 'Model';
define Obligo / analysis sum
format=comma10.
'Ob';
/*total after each groupkCat*/
break after grade /
/* ol*/
summarize
suppress
/*skip*/
;
/*global total*/
/*rbreak after / summarize;*/
/*compute after;*/
/*type = 'Total';*/
/*endcomp;*/
run;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.