I have two variables - spline variable of height and a binary variable. How do I write contrast to get difference in spline effects with respect to a reference at height=50 when sex=M and sex=F? How can this be wriiten using positional syntax?
data Have(rename=(height=BMI));
set sashelp.class;
keep Height sex age;
run;
proc phreg data=have;
class sex(ref="F")/param=ref;
effect bmiS=spline(bmi/ basis=tpf(noint) NATURALCUBIC details knotmethod=percentiles(4));
model age=sex bmiS bmiS*sex;
store result;
run;
%LET ref=50; %LET value=65;
proc plm restore=result;
**for females;
estimate "1. &value. VS &ref. sex level 1" bmis [-1, &ref.] [1, &value.] sex*bmis [-1, 1 &ref.] [1, 1 &value.]/ e exp cl;* cov;
estimate "2. &value. VS &ref. " bmis [-1, &ref.] [1, &value.] / e exp cl;* cov;
**for males;
estimate "3. &value. VS &ref. sex level 2" sex 1 bmis [-1, &ref.] [1, &value.] sex*bmis [-1, 2 &ref.] [1, 2 &value.]/ e exp cl;* cov;
estimate "4. &value. VS &ref. sex level 2 (ref)" sex 1 bmis [-1, &ref.] [1, &value.] sex*bmis [-1, 2 &ref.] [1, 2 &value.]/ e exp cl;* cov;
run;
I would like to know if the above contrast is correct and how can this be written using positional syntax. Thanks.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.