Resources

Bill of Material Verification (bom7)

/**************************************************************/
/*                                                            */
/*             S A S   S A M P L E   L I B R A R Y            */
/*                                                            */
/*    NAME: BOM7                                              */
/*   TITLE: Bill of Material Verification (bom7)              */
/* PRODUCT: OR                                                */
/*  SYSTEM: ALL                                               */
/*    KEYS: OR                                                */
/*   PROCS: BOM, PRINT, SORT, BOM MACROS                      */
/*    DATA:                                                   */
/*                                                            */
/* SUPPORT:                             UPDATE:               */
/*     REF:                                                   */
/*    MISC: Example 7 from the BOM Procedure chapter of the   */
/*          BOM book.                                         */
/*                                                            */
/**************************************************************/


/**************************************************************

    Use PMaster4 and ParComp4 from BOM4 and BomOut5 from BOM5

**************************************************************/

/* Part master records from BOM4 */

data PMaster4;
input Part      $8.
      Desc      $24.
      Req       8.0
      Unit      $8.
      LeadTime  4.0
      ;
datalines;
1100    Finished shaft                 . Each    2
1200    6-Diameter steel plate         . Each    3
1201    7-Diameter steel plate         . Each    3
1202    8-Diameter steel plate         . Each    3
1300    Hub                            . Each    2
1400    1/4-20 Screw                   . Each    1
1500    Steel holder                   . Each    2
1600    One-way socket                 . Each    2
1601    Three-way socket               . Each    2
1700    Wiring assembly                . Each    1
2100    3/8 Steel tubing               . Inches  3
2200    16-Gauge lamp cord             . Feet    2
2300    Standard plug terminal         . Each    1
4000    Common parts                   . Each    0
A100    Socket assembly                . Each    1
A101    Three-way socket assem.        . Each    1
A10X    Socket assembly options        . Each    0
B100    Base assembly                  . Each    1
B101    7in Base assembly              . Each    1
B102    8in Base assembly              . Each    1
B10X    Base assembly options          . Each    0
LAXX    Lamp LA                    10000 Each    3
S100    Black shade                    . Each    2
S101    14in White shade               . Each    2
S102    14in Cream shade               . Each    2
S103    14in Yellow shade              . Each    2
S104    15in Black shade               . Each    2
S105    15in White shade               . Each    2
S106    15in Cream shade               . Each    2
S107    15in Yellow shade              . Each    2
S10X    Shade options                  . Each    0
;


proc sort data=PMaster4;
by Part;
run;

/* Parent-component relationship data from BOM4*/

data ParComp4;
format Parent Component $8.;
input Parent    $8.
      Component $8.
      QtyPer    8.2
      ;
datalines;
LAXX    4000        1.00
LAXX    B10X        1.00
LAXX    S10X        1.00
LAXX    A10X        1.00
4000    1100        1.00
4000    1300        1.00
4000    1400        4.00
4000    1500        1.00
4000    1700        1.00
B10X    B100        0.32
B10X    B101        0.41
B10X    B102        0.33
S10X    S100        0.07
S10X    S101        0.18
S10X    S102        0.24
S10X    S103        0.10
S10X    S104        0.06
S10X    S105        0.14
S10X    S106        0.22
S10X    S107        0.10
A10X    A100        0.11
A10X    A101        0.92
B100    1200        1.00
B101    1201        1.00
B102    1202        1.00
A100    1600        1.00
A101    1601        1.00
1100    2100       26.00
1500    1400        2.00
1700    2200       12.00
1700    2300        1.00
;


/* Indented BOM output data set from BOM5 */

data BomOut5;
input _Prod_    $8.
      _Parent_  $8.
      _Part_    $8.
      QtyPer
      LeadTime
      Tot_Lead
      Desc      $24.
      Unit      $8.
      Paren_ID
      Part_ID
      _Level_
      Qty_Prod
      ;
datalines;
LA01            LA01     . 2 2 Lamp LA                   Each   .  1 0  1
LA01    LA01    4000     1 0 2 Common parts              Each   1  2 1  1
LA01    4000    1100     1 2 4 Finished shaft            Each   2  3 2  1
LA01    1100    2100    26 3 7 3/8 Steel tubing        Inches   3  4 3 26
LA01    4000    1300     1 2 4 Hub                       Each   2  5 2  1
LA01    4000    1400     4 1 3 1/4-20 Screw              Each   2  6 2  4
LA01    4000    1500     1 2 4 Steel holder              Each   2  7 2  1
LA01    1500    1400     2 1 5 1/4-20 Screw              Each   7  8 3  2
LA01    4000    1700     1 1 3 Wiring assembly           Each   2  9 2  1
LA01    1700    2200    12 2 5 16-Gauge lamp cord        Feet   9 10 3 12
LA01    1700    2300     1 1 4 Standard plug terminal    Each   9 11 3  1
LA01    LA01    B100     1 1 3 Base assembly             Each   1 12 1  1
LA01    B100    1200     1 3 6 6-Diameter steel plate    Each  12 13 2  1
LA01    LA01    S100     1 2 4 Black shade               Each   1 14 1  1
LA01    LA01    A100     1 1 3 Socket assembly           Each   1 15 1  1
LA01    A100    1600     1 2 5 One-way socket            Each  15 16 2  1
;


/**************************************************************

                           Begin example

**************************************************************/

/* Gross requirement transactional data set */
data Trans7;
format Part $8. Req 8.0 ;
input Part $ Req ;
datalines;
LAXX           1
B100           1
B101           0
B102           0
S100           1
S101           0
S102           0
S103           0
S104           0
S105           0
S106           0
S107           0
A100           1
A101           0
;


proc sort data=Trans7;
   by Part;
run;

/* Update the gross requirement values of the */
/* Product Structure data set                 */
data PMaster7(drop=OldReq);
merge PMaster4(rename=(Req=OldReq)) Trans7(in=in2);
by Part;

if not in2 then Req=OldReq;
run;


   /* Generate the indented BOM and summarized parts list */
proc bom data=ParComp4 pmdata=PMaster7
         out=IndBOM7 summaryout=SumBOM7;
   structure / part=Part
               requirement=Req
               leadtime=LeadTime
               parent=Parent
               component=Component
               quantity=QtyPer
               id=(Desc Unit);
run;

/* Sort and display the summarized parts list */

proc sort data=SumBOM7;
by _Part_;
run;

proc print data=SumBOM7(where=(Net_Req NE 0)) noobs;
title 'ABC Lamp Company';
title3 'Summarized Parts List, Period 1';
run;

/* Create the summarized bill of material */
%bomrsub(root='LA01', in=BomOut5, quantity=QtyPer,
qtyreq=Gros_Req, out=BomOut7);


/* Display the summarized bill of material */

proc print data=BomOut7 noobs;
var _Part_ Gros_Req Desc Unit;
title 'ABC Lamp Company';
title3 'Summarized Bill of Material, Part LA01';
run;