/*---------------------------------------------------------------
                                                                
               S A S   S A M P L E   L I B R A R Y              
                                                                
      NAME: BOME06                                              
     TITLE: Bill of Material w/ Repeated Relationships          
            (bome06)                                            
   PRODUCT: OR                                                  
    SYSTEM: ALL                                                 
      KEYS: OR                                                  
     PROCS: BOM, PRINT, SORT                                    
      DATA:                                                     
                                                                
   SUPPORT:                             UPDATE:                 
       REF:                                                     
      MISC: Example 6 from the BOM Procedure chapter of the     
            BOM book.                                           
                                                                
---------------------------------------------------------------*/


/*--------------------------------------------------------------

                     Use PMaster3 from BOME03

--------------------------------------------------------------*/


/* Part master records from BOME03 */

data PMaster3;
input Part      $8.
      Desc      $24.
      Unit      $8.
      LeadTime  8.0
   ;
datalines;
1100    Finished shaft          Each           2
1200    6-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
1700    Wiring assembly         Each           1
2100    3/8 Steel tubing        Inches         3
2200    16-Gauge lamp cord      Feet           2
2210    14-Gauge lamp cord      Feet           2
2300    Standard plug terminal  Each           1
A100    Socket assembly         Each           1
B100    Base assembly           Each           1
LA01    Lamp LA                 Each           2
S100    Black shade             Each           2
;

/*--------------------------------------------------------------

                        Begin example

--------------------------------------------------------------*/


/* Product structure records  */

data ParComp6;
input Parent    $8.
      Component $8.
      QtyPer    4.0
      Fscrap    6.3
      Line      $8.
      PointUse  $8.
      LTOff     4.0
      ;
datalines;
LA01    B100       1  .   010     SA2        0
        S100       1  .   015     SA2        0
        A100       1  .   020     SA5       15
B100    1100       1  .   010     SA4A       0
        1200       1  .   020     SA4A       0
        1400       4 0.25 110     SA4A       0
        1300       1  .   120     SA4B      20
        1400       4 0.5  215     SA4B      20
A100    1500       1  .   100     SA3        0
        1600       1  .   110     SA3        0
        1700       1  .   120     SA5        0
1100    2100      26 0.2          SA9B       0
1500    1400       2  .           SA7        0
1700    2200      12 0.1  010     SA5        0
        2300       1  .   030     SA5        5
;


/* Display the product structure data set */

proc print data=ParComp6 noobs;
title 'ABC Lamp Company';
title3 'Product Structure Records';
run;

  /* Create the indented BOM */
proc bom data=ParComp6 pmdata=PMaster3 out=IndBOM6a;
   structure / part=Part
               leadtime=LeadTime
               parent=Parent
               component=Component
               quantity=QtyPer
               factor=Fscrap
               offset=LTOff
               id=(Desc Unit)
               rid=(Line PointUse)
               enditem=("LA01");
run;


/* Display the indented BOM data */

proc print data=IndBOM6a;
var _Level_ _Parent_ _Part_ Desc QtyPer Fscrap Qty_Prod
 Unit LeadTime Tot_Lead LTOff Tot_Off Line PointUse _Prod_;
title 'ABC Lamp Company';
title3 'Indented Bill of Material, Part LA01';
run;

/* Create the indented BOM */
proc bom data=ParComp6 pmdata=PMaster3 out=IndBOM6b
      duplicate=KEEP;
structure / part=Part
            leadtime=LeadTime
            parent=Parent
            component=Component
            quantity=QtyPer
            factor=Fscrap
            id=(Desc Unit)
            enditem=("LA01");
run;


/* Display the indented BOM data */

proc print data=IndBOM6b noobs;
var _Level_ _Parent_ _Part_ Desc QtyPer Fscrap Qty_Prod
    Unit LeadTime Tot_Lead _Prod_;
title 'ABC Lamp Company';
title3 'Indented Bill of Material, Part LA01';
run;

/* Create the indented BOM */
proc bom data=ParComp6 pmdata=PMaster3 out=IndBOM6c
      duplicate=COMBINE;
structure / part=Part
            leadtime=LeadTime
            parent=Parent
            component=Component
            quantity=QtyPer
            factor=Fscrap
            id=(Desc Unit)
            enditem=("LA01");
run;

/* Display the indented BOM data */

proc print data=IndBOM6c noobs;
var _Level_ _Parent_ _Part_ Desc QtyPer Fscrap Qty_Prod
    Unit LeadTime Tot_Lead _Prod_;
title 'ABC Lamp Company';
title3 'Indented Bill of Material, Part LA01';
run;