Details Examples (bomd01)
/**************************************************************/
/* */
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: BOMD01 */
/* TITLE: Details Examples (bomd01) */
/* PRODUCT: OR */
/* SYSTEM: ALL */
/* KEYS: OR PPLOT */
/* PROCS: BOM, PRINT, NETDRAW, SQL */
/* DATA: */
/* */
/* SUPPORT: UPDATE: */
/* REF: */
/* MISC: Examples from the Details sections in the BOM */
/* Procedure chapter from the BOM book. */
/* */
/**************************************************************/
/**************************************************************
Use IndBOM0 from BOMG01
**************************************************************/
/* Part master records from BOMG01 */
data PMaster0;
input Part $8.
Desc $24.
Unit $8.
;
datalines;
1100 Finished shaft Each
1200 6-Diameter steel plate Each
1300 Hub Each
1400 1/4-20 Screw Each
1500 Steel holder Each
1600 One-way socket Each
1700 Wiring assembly Each
2100 3/8 Steel tubing Inches
2200 16-Gauge lamp cord Feet
2300 Standard plug terminal Each
A100 Socket assembly Each
B100 Base assembly Each
LA01 Lamp LA Each
S100 Black shade Each
;
/* Product structure records from BOMG01 */
data ParComp0;
input Parent $8.
Component $8.
QtyPer 4.0
;
datalines;
LA01 B100 1
LA01 S100 1
LA01 A100 1
B100 1100 1
B100 1200 1
B100 1300 1
B100 1400 4
A100 1500 1
A100 1600 1
A100 1700 1
1100 2100 26
1500 1400 2
1700 2200 12
1700 2300 1
;
/* Indented BOM and summarized parts list from BOMG01 */
proc bom data=ParComp0 pmdata=PMaster0
out=IndBOM0 summaryout=SumBOM0;
structure / part=Part
parent=Parent
component=Component
quantity=QtyPer
id=(Desc Unit);
run;
/**************************************************************
Begin Details
**************************************************************/
/* Display the components that are directly used */
/* in item LA01 */
proc print data=IndBOM0(where=(_Parent_='LA01')
rename=(_Part_=Component))
noobs;
var Component Desc QtyPer Unit;
title 'ABC Lamp Company';
title3 'Single-level Bill of Material Retrieval, Part LA01';
run;
/* Create the where-used data set */
data Used0a(keep=_Parent_ Paren_ID QtyPer Unit);
set IndBOM0(where=(_Part_='1400'));
run;
/* Get the part description from the IndBOM0 data set */
proc sql;
create table Used0b as
select Used0a._Parent_, IndBOM0.Desc,
Used0a.QtyPer, Used0a.Unit
from Used0a left join IndBOM0
on Used0a.Paren_ID=IndBOM0.Part_ID;
quit;
/* Display the where-used data set */
proc print data=Used0b noobs;
var _Parent_ Desc QtyPer Unit;
title 'ABC Lamp Company';
title3 'Single-level Where-used Report, Part 1400';
run;