Hello @Jeb1 and welcome to the SAS Support Communities!
Maybe there's a more elegant way to achieve what you want, but one idea is to use two VLINE statements in the PROC SGPLOT step: one using the DATALABEL option and the other not using it.
Suppose that for annees_fin_ensemble in (2019, 2021) you want to display data labels, but not for the other years. Then you could create a dataset WANT like
data want;
set DCAT_RLS_TOTAL;
if annees_fin_ensemble in (2019, 2021) then do;
_var4=var4;
var4=.;
end;
run;
and use it in PROC SGPLOT:
proc sgplot data = want;
vline periode / response = var4 group = annees_fin_ensemble markers markerattrs=(symbol=circlefilled size=8) name='part1';
vline periode / response = _var4 group = annees_fin_ensemble markers markerattrs=(symbol=circlefilled size=8) datalabel;
keylegend 'part1' / noborder title = "";
...
run;
So you overlay two VLINE plots with only slightly different options and restrict the KEYLEGEND to one of the plots to avoid duplication.
I suspect that the label specified in the REFLINE statement does not appear in the graph because you are using a variable (X) so that the label should also be supplied as a variable. (See the documentation of the LABEL option.)
... View more