Quantcast
Channel: Statistics Help @ Talk Stats Forum - SAS
Viewing all articles
Browse latest Browse all 310

How to subtotal rows

$
0
0
I need to subtotal some of my rows. For example, multipe rows have the same contract number and material code. I need to add the inspection quantity from these two rows together. Is there any way to do this. This is my code for this section.
PROC SQL;
CREATE TABLE qcqalist as
SELECT cmat_cont_num
,cmat_lin
,cmat_item_code
,cmat_mtrl_code
,cmat_item_code as ItemDesc format=$biditems.
,cmat_mtrl_code as MtrlDesc format=$engdata.
,cmat_mtrl_type
/* ,cmat_cnvrsn_fctr*/
,cmat_mtrl_insp_qty
,datepart(cmat_lmts) as Date format=mmddyy10.
,year(calculated date) as Year


FROM dtdb2cms.t_mcmat


WHERE cmat_cont_num in
(SELECT distinct cont_cont_num
FROM dtdb2cms.t_chist
,dtdb2cms.t_cclin
,dtdb2cms.t_ccont

where hist_item_code eq '071713'

and cont_let_date between '01JAN1999'd and '31DEC2012'd
and hist_item_code = clin_item_code
and cont_cont_num = clin_cont_num
)
/*'508122174'*/
and cmat_mtrl_code like 'PCC%'
and cmat_item_code in (&biditems)

;
proc print;
quit;

Viewing all articles
Browse latest Browse all 310

Trending Articles