Resources

Bill of Material with Single Input Data Set (bom1)

/***************************************************************/
/*                                                             */
/*          S A S   S A M P L E   L I B R A R Y                */
/*                                                             */
/*    NAME: BOM1                                               */
/*   TITLE: Bill of Material with Single Input Data Set (bom1) */
/* PRODUCT: OR                                                 */
/*  SYSTEM: ALL                                                */
/*    KEYS: OR PPLOT                                           */
/*   PROCS: BOM, PRINT, NETDRAW                                */
/*    DATA:                                                    */
/*                                                             */
/* SUPPORT:                             UPDATE:                */
/*     REF:                                                    */
/*    MISC: Example 1 from the BOM Procedure chapter of the    */
/*          BOM book.                                          */
/*                                                             */
/***************************************************************/


/* The input data set */

data SlBOM1;
input Parent        $6.
Desc          $24.
Unit          $6.
(Comp1-Comp3) ($6.)
(Qty1-Qty3)   (4.0)
;
datalines;
LA01  Lamp LA                 Each  B100  S100  A100     1   1   1
B100  Base assembly           Each  1100  1200  1300     1   1   1
                                    1400                 4   .   .
S100  Black shade             Each                       .   .   .
A100  Socket assembly         Each  1500  1600  1700     1   1   1
1100  Finished shaft          Each  2100                26   .   .
1200  6-Diameter steel plate  Each                       .   .   .
1300  Hub                     Each                       .   .   .
1400  1/4-20 Screw            Each                       .   .   .
1500  Steel holder            Each  1400                 2   .   .
1600  One-way socket          Each                       .   .   .
1700  Wiring assembly         Each  2200  2300          12   1   .
2100  3/8 Steel tubing        Inches                     .   .   .
2200  16-Gauge lamp cord      Feet                       .   .   .
2300  Standard plug terminal  Each                       .   .   .
;




/* Display the input data set */

proc print data=SlBOM1 noobs;
title 'ABC Lamp Company';
title3 'PROC BOM Input Data Set';
run;


/* Create the indented BOM and the summarized parts list */
proc bom data=SlBOM1 out=IndBOM1 summaryout=SumBOM1;
   structure / part=Parent
               parent=Parent
               component=(Comp1-Comp3)
               quantity=(Qty1-Qty3)
               id=(Desc Unit);
run;


/* Display the indented BOM data */

proc print data=IndBOM1 noobs;
var _Level_ _Parent_ _Part_ Desc Qty_Per Qty_Prod
    Unit Paren_ID Part_ID _Prod_;
title 'ABC Lamp Company';
title3 'Indented Bill of Material, Part LA01';
run;



proc sort data=SumBOM1;
by _Part_;
run;

proc print data=SumBOM1 noobs;
title 'ABC Lamp Company';
title3 'Summarized Parts List, Period 1';
run;


/* Draw a tree diagram for illustrating the product structure */
/* Each record denotes a node in the tree */
data IndBOM1a(drop=Part_ID);
   set IndBOM1;
   Paren_ID=Part_ID;
run;

/* Extract the Parent - Part information */
data IndBOM1b;
   set IndBOM1(keep=Paren_ID Part_ID);
run;

/* Prepare the data set for running NETDRAW */
data TreBOM1;
   set IndBOM1a IndBOM1b;
run;

/* Specify graphics options */
goptions hpos=32 vpos=80 border;
pattern1 v=s c=blue;

title h=5 j=c 'Multilevel Bill of Material Diagram';
footnote h=2 j=l
   'Node shows ID Number, Part Number, and Quantity Required';



/* Invoke PROC NETDRAW to display BOM tree */
proc netdraw data=TreBOM1( where=(Paren_ID NE .) ) out=NetOUT;
   actnet / act=Paren_ID succ=Part_ID id=(Paren_ID _Part_ Qty_Per)
            ctext=white htext=3 font=swiss carcs=black
            ybetween=3 xbetween=8 centerid
            tree pcompress rotatetext rotate
            arrowhead=0 rectilinear nodefid nolabel;
run;