BookmarkSubscribeRSS Feed
dapenDaniel
Obsidian | Level 7

Hello,

 

I have a dataset. It records the products that companies produce each year and the components for each product ("Categories" column is only for convenience and it is not in my real dataset). All the components of each firm in five years consist of a component base. It is updated as firms introduce more products. The file has been sorted by FirmID, Beginyear and components.

 

If all the components of a new product do not overlap with the component base in five years, it will be considered as radical products. For example, Firm 10002 introduced KJ128F in 1996 and its components were Z14 and T32, which do not exist in the component base between 1991 and 1995 within Firm 10002. Thus KJ128F is a radical product.

 

If one of the components of a new product overlaps with the component base in five years, it will be considered as incremental products. For example, Firm 10002 introduced OP284L in 1995 and its component was X48. X48 exists in the component base between 1990 and 1994. So OP284L is an incremental product.

 

I would like to know how many incremental products and radical products that each firm has for each year. The output that I want is below. In case you need the file, I also attached the excel file.

 

Have data:

FirmIDProductIDBeginYearComponentsCategories
10001AA386G1992B30radical
10001AA386G1992V55
10001AA386G1992T92
10001AB259T1993R26Incremental
10001AB259T1993V55
10001AB259T1993U38
10001AC449P1993Y38radical
10001AC449P1993I92
10002XV429S1990E33radical
10002CT746B1991X48radical
10002CT746B1991K93
10002CT746B1991O28
10002RU239F1992X48Incremental
10002RU239F1992Q15
10002DH469E1993K93Incremental
10002DH469E1993Q15
10002MH387T1994O28Incremental
10002OP284L1995X48Incremental
10002KJ128F1996Z14Radical
10002KJ128F1996T32
10003CN726Q1991E55radical
10003SZ116R1992E55Incremental
10003SZ116R1992W87
10003TU692E1992W87Incremental
10003TU692E1992I92

 

want data

FirmIDBeginYearnb_Incrementalnb_Radical
10001199201
10001199311
10002199001
10002199101
10002199210
10002199310
10002199410
10002199510
10002199601
10003199101
10003199220
4 REPLIES 4
Reeza
Super User
Isn't the same as your previous questions, but you're limiting the data to 5 years? Or am I missing something?
dapenDaniel
Obsidian | Level 7

Yes. You are correct but I do not know how to revise the code offered by Ksharp to limit the data to 5 years. The link is for the previous question.

 

https://communities.sas.com/t5/New-SAS-User/Iterative-Match/m-p/591821#M15276

 

Reeza
Super User
So your real question is how to limit years. Can you explain how the 5 years are filtered? Is it a specific 5 years? Is it relative to a date variable?
dapenDaniel
Obsidian | Level 7

Thank you, @Reeza ! It is like a rolling window. For example, if a product was introduced in 2000, I would like to know whether the components of this product exist in the component base from 1995 to 1999. If a product was introduced in 2003, I would like to know whether the components exist in the component base from 1998 to 2002. Does that make sense? 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 753 views
  • 0 likes
  • 2 in conversation