I'm trying to replicate the methodology described on pg 18386 of https://www.govinfo.gov/content/pkg/FR-2025-04-30/pdf/2025-06271.pdf. I am confused by this statement: "The risk adjustment factors will be calculated at the MS–
DRG/HCPCS level on baseline episodes, using a weighted linear regression where episodes are weighted differentially based on whether they belong to year 1, 2, or 3 of the baseline periods. Episodes from baseline year 1 will be weighted at 17 percent, baseline year 2 at 33 percent, and baseline year 3 at 50 percent." Does anyone know how to translate this to high-level SAS code?
Do you mean you just want to know what weights to use? You can just use 0.17, 0.33 and 0.50 for year 1, year 2 and year 3, respectively.
data for_model;
set for_model;
if base_year=1 then wt=0.17;
else if base_year=2 then wt=0.33;
else if base_year=3 then wt=0.50;
run;
proc reg /* or whatever model proc you are using */ data=for_model;
WEIGHT wt;
** other model statements ;
run;
There's nothing magic about the 0.17, 0.33 and 0.50. You could just as well use 17, 33 and 50, or 34, 66 and 100 -- they will also produce the same result as long as the weights are of the same relative magnitude. Also note that if you simply replicated observations in your input dataset (i.e., make 17 copies of each base year 1 record, 33 of each base year 2 and 50 of each base year 3) and then left off the weight statement, the same thing will happen in terms of the point estimates (NOT that you should do that, as it will affect standard errors / CIs).
Do you mean you just want to know what weights to use? You can just use 0.17, 0.33 and 0.50 for year 1, year 2 and year 3, respectively.
data for_model;
set for_model;
if base_year=1 then wt=0.17;
else if base_year=2 then wt=0.33;
else if base_year=3 then wt=0.50;
run;
proc reg /* or whatever model proc you are using */ data=for_model;
WEIGHT wt;
** other model statements ;
run;
There's nothing magic about the 0.17, 0.33 and 0.50. You could just as well use 17, 33 and 50, or 34, 66 and 100 -- they will also produce the same result as long as the weights are of the same relative magnitude. Also note that if you simply replicated observations in your input dataset (i.e., make 17 copies of each base year 1 record, 33 of each base year 2 and 50 of each base year 3) and then left off the weight statement, the same thing will happen in terms of the point estimates (NOT that you should do that, as it will affect standard errors / CIs).
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.