Hello everyone, I am a beginner with Stata (using version 16.1) and I am working with patent transaction data.

My problem is that I am trying to construct panel data based on dummy variables. I have a variable called patent_app_year which identifies the year each individual patent application was made and a variable called pat_grant_year which identifies the year that the patent transaction was granted/approved. The data spans between the years 2000 and 2017.

Accordingly, I have created dummy variables that take the value of 1 if an application was made in a given year and 0 otherwise and a dummy variable that takes a value of 1 if a patent was granted in a given year and 0 otherwise.

As a result I have dummy variables for pat_app_year for years 2000-2017 (e.g. patent_app_year2000) and dummy variables for pat_grant_year for years 2000-2017. My first question is since all patents have the info regarding the year of application and year of grant, how can I reconstruct a panel based on each year.

Secondly, how might I create a variable such as "patent_count" which would indicate which granted patents are in which firms portfolio.

My data is confidential. However in line with the faq's, I have created a fake example which I have attempted to paste via dataex (below).

I sincerely appreciate any advice/help.

Thanks for your time!
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str18(acquiror_id seller_id patent_id) int(patent_app_year patent_grant_year) float(patent_app_year2000 patent_app_year2001 patent_app_year2002 patent_grant_year2000 patent_grant_year2001 patent_grant_year2002)
"1" "ca1" "01" 2000 2000 1 0 0 1 0 0
"2" "ca1" "02" 2000 2001 1 0 0 0 1 0
"3" "ca1" "03" 2001 2002 0 1 0 0 0 1
"4" "ca1" "04" 2002 2004 0 0 1 0 0 0
"4" "ca2" "05" 2003 2005 0 0 0 0 0 0
"4" "ca2" "06" 2006 2006 0 0 0 0 0 0
"5" "ca2" "07" 2009 2013 0 0 0 0 0 0
"6" "ca3" "08" 2010 2012 0 0 0 0 0 0
"7" "ca3" "09" 2011 2012 0 0 0 0 0 0
"8" "ca3" "10" 2012 2012 0 0 0 0 0 0
end