I would like to generate two dummy variables: "same_month" and "same_day". Basically, by id and group, if it happens in the same day, I need to flag it as 1 in the "same_day" dummy variable. By id and group, if it happens in the same month, flag it as 1 in the "same_month" dummy variable. ​​​​​​ Any suggestions? Thanks a lot in advance.
​​​​​​
Array

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str9 id float date str12 group float month
"1" 20769 "a" 682
"1" 20873 "a" 685
"1" 20852 "a" 685
"1" 20769 "b" 682
"1" 20873 "b" 685
"1" 20873 "b" 685
"1" 20769 "c" 682
"1" 20873 "c" 685
"1" 20901 "c" 686
"2" 20769 "a" 682
"2" 20873 "a" 685
"2" 20852 "a" 685
"2" 20769 "b" 682
"2" 20873 "b" 685
"2" 20873 "b" 685
"2" 20769 "c" 682
"2" 20873 "c" 685
"2" 20901 "c" 686
end
format %td date
format %tm month