Dear all,
My goal is to merge DataA with DataB based on ticker and matching year and month in order to get variable ncus from DataB
I came across a post by Nick Cox (https://www.statalist.org/forums/for...t-and-end-date)
, and find it useful, however, I am stuck on how to add the year variable in order to match both year and month.


Code:
* DataA
clear
input str6 ticker int(sdate edate)
"SLAM" 13320 15461
end
format %d sdate
format %d edate


** DataB
clear
input str4 ticker int year byte month str3 ncus
"SLAM" 1996 1 "abx"
"SLAM" 1996 2 "dex"
"SLAM" 1997 1 "d3x"
"SLAM" 2002 1 "35x"
"SLAM" 2002 2 "dex"
end
I am not good with date function, my initial thought is to add a month variable to DataB that matches with DataA, then use that as a linking variable.

Your help will be greatly appreciated !


Rochelle