Hello!
I have to deal with a product structure that includes by-products. For example (sample code below), product P2 requires per unit 0.8 units of component C1 and 0.5 units of component C4, resp. In addition, the production step yields .25 units of by-product C5.
My question is, whether there is a structured approach to deal with this. I think that I can get to the desired result by some data manipulation (checking if a component has a predecessor which is a by-product), but I am looking for a way to get there without doing too much "violence" to the data.
Thanks&kind regards
An example code would look like this (gives a wrong result due to the negative product component):
Data ProductStructure;
Input Product $ Component $ Qty;
Datalines;
P1 C1 0.60
P1 C2 0.30
P1 C3 0.40
P1 C4 0.05
P2 C1 0.80
P2 C4 0.50
P2 C5 -0.25
C1 C11 0.30
C1 C12 0.15
C1 C13 0.15
C5 C51 0.50
C5 C52 0.50
;
Run;
Data PartMaster;
Input Descr $ Text $15.;
Datalines;
P1 Product_1
P2 Product_2
C1 Component_1
C2 Component_2
C3 Component_3
C4 Component_4
C5 Byproduct_5
C11 Subcomponent_1
C12 Subcomponent_2
C13 Subcomponent_3
C51 Subbyproduct_1
C52 Subbyproduct_2
;
Run;
Proc BOM Data=ProductStructure
PMData=PartMaster
Out=BOM_Result
;
Structure / Part=Descr
Parent=Product
Component=Component
Quantity=Qty
ID=(Text)
;
Run;
Hi! Thanks for the clarification. Unfortunately we don't currently see a way for the BOM procedure to automatically handle the by-product in the same BOM. The only thing we can suggest is to add a by-product flag (1 if a by-product or 0 if not) to the product structure data set, and use the RID= option to specify the new variable. Then, at least, you will be able to identify by-products in the indented BOM for post-processing.
Regards,
Lindsey
Hi! Thanks for your question. We are currently investigating this and will reply soon.
Lindsey
Hi!
We weren't sure in your example if the C51 and C52 items are used to produce more of C5 or if the C5 by-product is used to produce C51 and C52. We do want to fully explore your requirement in the hope that we might be able to help. I spoke with the developer of the BOM procedure, and he thought that typically the by-products are produced in one BOM and consumed in another. You might introduce a multiplier variable (1 or -1) that could be carried into the output with the ID= option, to indicate whether the item is produced or consumed.
Thanks!
Lindsey
Hi!
Thanks for your reply. You are right, sub-levels of by-products technically seem not make sense.
The correct product structure and part master would be:
Data ProductStructure;
Input Product $ Component $ Qty;
Datalines;
P2 C1 0.80
P2 C4 0.35
P2 C5 -0.1
C1 C11 0.30
C1 C12 0.50
C1 C5 0.25
;
Run;
Data PartMaster;
Input Descr $ Text $35.;
Datalines;
P2 Product_2
C1 Component_1
C4 Component_4
C5 Byproduct_of_P2_and_Component_of_C1
C11 Subcomponent_1
C12 Subcomponent_2
;
Run;
Proc BOM Data=ProductStructure
PMData=PartMaster
Out=BOM_Result
;
Structure / Part=Descr
Parent=Product
Component=Component
Quantity=Qty
ID=(Text)
;
Run;
The problem is, that the by-product (C5) occurs as input and output (exactly the same name and material number), this is I can´t directly use a "Is_Output_or_Input"-Flag or so (would have to add the flag to ID, then proc bom, then correct result).
The quantities cannot cancel out each other because they are on different levels of the b-o-m.
Sorry that I didn't get the product structure right the first time. Graphically, what I mean is:
Hi! Thanks for the clarification. Unfortunately we don't currently see a way for the BOM procedure to automatically handle the by-product in the same BOM. The only thing we can suggest is to add a by-product flag (1 if a by-product or 0 if not) to the product structure data set, and use the RID= option to specify the new variable. Then, at least, you will be able to identify by-products in the indented BOM for post-processing.
Regards,
Lindsey
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.