Comparison of Actual and Budget
/*--------------------------------------------------------------
SAS Sample Library
Name: ctaex03.sas
Description: Example program from SAS/ETS User's Guide,
The COMPUTAB Procedure
Title: Comparison of Actual and Budget
Product: SAS/ETS Software
Keys: programmable tabular reports
PROC: COMPUTAB
Notes:
--------------------------------------------------------------*/
data incomrep;
length type $ 8;
input type :$8. date :monyy7.
sales retdis tcos selling randd
general admin deprec other taxes;
format date monyy7.;
datalines;
BUDGET JAN1989 4600 300 2200 480 110 500 210 14 -8 510
BUDGET FEB1989 4700 330 2300 500 110 500 200 14 0 480
BUDGET MAR1989 4800 360 2600 500 120 600 250 15 2 520
ACTUAL JAN1989 4900 505 2100 430 130 410 200 14 -8 500
ACTUAL FEB1989 5100 480 2400 510 110 390 230 15 2 490
;
title 'Pro Forma Income Statement';
title2 'XYZ Computer Services, Inc.';
title3 'Budget Analysis';
title4 'Amounts in Thousands';
options linesize=96;
proc computab data=incomrep;
columns cmbud cmact cmpct ytdbud ytdact ytdpct /
zero=' ';
columns cmbud--cmpct / mtitle='- Current Month: February -';
columns ytdbud--ytdpct / mtitle='- Year To Date -';
columns cmbud ytdbud / 'Budget' f=comma6.;
columns cmact ytdact / 'Actual' f=comma6.;
columns cmpct ytdpct / '% ' f=7.2;
columns cmbud--ytdpct / '-';
columns ytdbud / _titles_;
retain curmo 2; /* current month: February */
rows sales / ' '
'Gross Sales';
rows retdis / 'Less Returns & Discounts';
rows netsales / 'Net Sales' +3 ol;
rows tcos / ' '
'Total Cost of Sales';
rows grosspft / ' '
'Gross Profit' +3;
rows selling / ' '
'Operating Expenses:'
' Selling';
rows randd / ' R & D';
rows general / +3;
rows admin / ' Administrative';
rows deprec / ' Depreciation' ul;
rows operexp / ' ';
rows operinc / 'Operating Income' ol;
rows other / 'Other Income/-Expense' ul;
rows taxblinc / 'Taxable Income';
rows taxes / 'Income Taxes' ul;
rows netincom / ' Net Income' dul;
cmbud = type = 'BUDGET' & month(date) = curmo;
cmact = type = 'ACTUAL' & month(date) = curmo;
ytdbud = type = 'BUDGET' & month(date) <= curmo;
ytdact = type = 'ACTUAL' & month(date) <= curmo;
rowcalc:
if cmpct | ytdpct then return;
netsales = sales - retdis;
grosspft = netsales - tcos;
operexp = selling + randd + general + admin + deprec;
operinc = grosspft - operexp;
taxblinc = operinc + other;
netincom = taxblinc - taxes;
colpct:
if cmbud & cmact then cmpct = 100 * cmact / cmbud;
if ytdbud & ytdact then ytdpct = 100 * ytdact / ytdbud;
run;