The yr variable with a range of 2005-2016 becomes separate variables when the data are transformed. The variable stat has three values, "Deaths," "CMR", and "AAMR" which I format with 0, 1, and 2 decimal places, respectively. They appear that way in the datasets death2, cmr2, and aamr2 columns '2005'N-'2016'N . When I combine the datasets, the '2005'N-'2016'N columns are all formatted to 1 decimal place, instead of 0, 1, and 2 places that I want. The original data have 0 decimals for dths, 8 decimals for CMR and 8 decimals for AAMR. If I comment out the format lines below, the combined dataset has 0, 8, and 8 decimals in the '2005'N-'2016'N columns, demonstrating that they do not have to take the same format. Adding to my perplexity is that my program seemed to work yesterday as intended. I have tried closing and reopening SAS 9.4
proc sort data=AAMRtabout; by dthrank CODnum2 sex2; run;
proc transpose data=AAMRtabout out=dths_t (drop=_NAME_);
by dthrank CODnum2 sex2;
id yr;
var dths_sum;
run;
data death2;
set dths_t;
stat="Deaths";
run;
proc transpose data=AAMRtabout out=cmr_t (drop=_NAME_);
by dthrank CODnum2 sex2;
id yr;
var CMR_sum;
run;
data cmr2;
set cmr_t;
stat="CMR";
format '2005'N-'2016'N comma8.1;
run;
proc transpose data=AAMRtabout out=aamr_t (drop=_NAME_);
by dthrank CODnum2 sex2;
id yr;
var AAMR_sum;
run;
data AAMR2;
set aamr_t;
stat="AAMR";
format '2005'N-'2016'N comma8.2;
run;
data AAMRtabout_final;
retain dthrank CODnum2 sex2 stat;
set death2 cmr2 aamr2;
run;