Hello,

I have a syntax issue that I need assistance with. I have a dataset with confirmed COVID cases and deaths along with information on state mask mandates and public health posts communicating when a state (if they adopted) initiated a mask policy. Right now, the entire column for mandates and first public health department post show the date repeating, but I need this to be coded 0 (no policy) and 1 on the date from the daily_cases_date variable. Here's an example:

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input long confirmed float daily_cases_date long deaths byte demgov float(first_public_healthpost1 mandate_order_dates) long(state stateabbr) byte stateorder
49695 22105 1068 0 22112 22112 1 2 1
51329 22106 1104 0 22112 22112 1 2 1
52802 22107 1114 0 22112 22112 1 2 1
54781 22108 1121 0 22112 22112 1 2 1
56168 22109 1124 0 22112 22112 1 2 1
58284 22110 1164 0 22112 22112 1 2 1
60194 22111 1211 0 22112 22112 1 2 1
62128 22112 1230 0 22112 22112 1 2 1
64152 22113 1265 0 22112 22112 1 2 1
66181 22114 1286 0 22112 22112 1 2 1
67733 22115 1287 0 22112 22112 1 2 1
69236 22116 1291 0 22112 22112 1 2 1
70600 22117 1303 0 22112 22112 1 2 1
72594 22118 1364 0 22112 22112 1 2 1
74685 22119 1397 0 22112 22112 1 2 1
76795 22120 1438 0 22112 22112 1 2 1
78188 22121 1456 0 22112 22112 1 2 1
79948 22122 1473 0 22112 22112 1 2 1
81256 22123 1491 0 22112 22112 1 2 1
82698 22124 1491 0 22112 22112 1 2 1
84652 22125 1538 0 22112 22112 1 2 1
end
format %td daily_cases_date
format %td first_public_healthpost1
format %td mandate_order_dates
label values state statename
label def statename 1 "Alabama", modify
label values stateabbr stateabbr
label def stateabbr 2 "AL", modify
The code I'm using is
HTML Code:
replace first_public_healthpost1=1 if daily_cases_date= "16jul2020"
but I keep getting a syntax error (or a type mismatch error). This seems like the code I've created should work, but maybe I should just enter the line where the dates match instead? Or maybe it's the date formatting? Any assistance would be appreciated.