SSC

Estimate dynamic treatment effects when states, countries, firms, markets, or other units adopt the same policy at different dates. RainbowStats builds unit-specific synthetic controls, aggregates the effects by periods since adoption, and produces placebo-in-time inference.

Syntax

model=SSC(outcomes,policyDate1,policyDate2,...)
model=SSC(outcomes,policyDate1,policyDate2,...,ARG(END_DATE,yyyymmdd),ARG(MAX_POST_PERIODS,n))

STAGGERED_SYNTHETIC_CONTROL is the long alias. Supply one policy date for every series in outcomes, in exactly the same order. Dates are integers in YYYYMMDD form. Use 0 when a unit remains untreated during the analysis.

ArgumentDescription
outcomesA DataList containing one aligned outcome series per state, country, county, firm, market, or other unit.
policyDate...One adoption marker per outcome series. The first observation on or after the marker is treated.
ARG(END_DATE,date)Optional last calendar date included in the estimation sample. This is useful for excluding a later structural break such as COVID.
ARG(MAX_POST_PERIODS,n)Optional maximum event-time horizon. Shorter horizons preserve more contributors and more pretreatment placebo windows.
Generic by design. “Policy” can mean legislation, a medical rule, a market-structure change, an exchange-rate regime, a technology rollout, or another absorbing intervention. The dates must describe the same treatment concept for every unit.

Worked example: cannabis legalization and state productivity

This example asks whether the opening of licensed adult-use cannabis sales was followed by a change in state output per payroll job. Real state GDP is divided by quarterly payroll employment, and the 51 adoption markers correspond positionally to the series returned by LOOP_STATE2.

gdp=LOOP_STATE2($$RQGSP);
jobs=TO_QUARTERLY(LOOP_STATE2($$NA));
productivity=gdp/jobs;
model=SSC(productivity,0,20161029,20210122,0,20180101,20140101,20230110,20250801,0,0,0,0,0,20200101,0,0,0,0,0,20201009,20230701,20181120,20191201,20250916,0,20230203,20220101,0,20170701,0,20220421,20220401,20221229,0,0,0,20240806,0,20151001,0,20221201,0,0,0,0,20221001,0,20140708,0,0,0,ARG(END_DATE,20191231),ARG(MAX_POST_PERIODS,24));
SLIDESHOW(model);

END_DATE=20191231 deliberately ends the sample before COVID. Consequently, a late event-time increase in this run cannot be attributed to the pandemic. MAX_POST_PERIODS=24 limits the chart to six years after adoption.

Ordering is part of the model. The first policy date belongs to the first series in productivity, the second date to the second series, and so on. Always inspect the DataList order before supplying a date vector. A correctly formatted date attached to the wrong state silently changes the research design.

Extract and customize the event chart

event_chart returns an extractable D3LineChartOperator. Its numeric event-time axis can be relabeled and marked like any other D3 line chart.

chart=EXTRACT(model,event_chart);
chart=SET_TITLE(chart,Event-Time_Productivity_Effect_and_Shrinking_State_Coverage);
chart=SET_XAXIS(chart,Quarters_Since_Adult-Use_Cannabis_Sales);
chart=SET_YAXIS(chart,Estimated_Real_GDP_Per_Payroll_Job_Effect);
chart=ADD_XMARKER(chart,5,"MA out; N=6");
chart=ADD_XMARKER(chart,9,"CA out; N=5");
chart=ADD_XMARKER(chart,11,"NV out; N=4");
chart=ADD_XMARKER(chart,13,"AK out; N=3");
chart=ADD_XMARKER(chart,18,"OR out; N=2");
chart=ADD_XMARKER(chart,22,"WA out; N=1 (CO)");
chart;
First affected event periodState leaving the averageContributors remaining
1–4None7
5Massachusetts6
9California5
11Nevada4
13Alaska3
18Oregon2
22Washington1 — Colorado
What makes the chart interesting. The estimated effect rises at longer horizons, but the contributing sample is simultaneously shrinking. After period 22 the estimate is Colorado’s experience alone. The narrower late confidence band is therefore compositional; it should not be interpreted as stronger seven-state evidence.

Interpret the outcome carefully

gdp/jobs is a transparent proxy for real output per payroll job, not the official BLS measure of labor productivity per hour. A positive ratio effect can arise because output increases, because payroll employment falls, or both. Before giving the result a productivity interpretation, estimate the numerator and denominator separately.

The adult-use dates also do not identify a medical-cannabis mechanism. Medical access generally predates adult-use retail sales in these states. Testing that hypothesis requires a separate model built from consistent medical dispensary opening dates.

What the estimator does

  1. Aligns all outcome series and finds the common period before any included unit is treated.
  2. Represents each unit as a convex combination of the other units using the common untreated history.
  3. Jointly estimates treated unit-by-calendar-time effects.
  4. Aggregates those estimates by periods since adoption to form dynamic ATT estimates.
  5. Moves the treatment pattern through pretreatment history to obtain pointwise confidence intervals and p-values.

Extractable results

ExtractResult
slideshowComplete diagnostic presentation.
summaryModel dimensions, sample dates, aggregate effect, inference, and warnings.
adoptionPolicy-adoption timeline and sample treatment status.
event_chartExtractable D3 event-time ATT chart with estimates and 95% bounds.
event_attMatrix containing event time, ATT, lower and upper bounds, p-value, contributor count, and placebo-window count.
unit_effectsHeterogeneous unit-by-calendar-time treatment effects.
weightsFull donor-weight matrix.
pre_fitPretreatment RMSPE and largest donor for every unit.
min_eigenvalueIdentification and numerical-stability diagnostic.
overall_attAverage across all identified treated unit-periods.
jsonComplete structured result for downstream applications.

Required assumptions and diagnostics

Always inspect donor weights, pretreatment RMSPE, contributor counts, placebo-window counts, and the minimum eigenvalue. A persuasive-looking post-treatment path is not enough when fit is weak, the design is nearly singular, or late horizons represent only one unit.

Not identified after everyone is treated. If every unit eventually adopts, RainbowStats truncates the usable horizon immediately before the last untreated unit adopts. Never-treated and not-yet-treated units supply the counterfactual information.

Reference

Jianfei Cao, Shirley Lu, and Hang Wu, “Synthetic control inference for staggered adoption,” The Econometrics Journal, 29(3), 2026, 323–342.