BookmarkSubscribeRSS Feed
PamG
Quartz | Level 8

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;

 

1 REPLY 1
PamG
Quartz | Level 8

I would like to know if the above contrast is correct and how can this be written using positional syntax.  Thanks.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 370 views
  • 0 likes
  • 1 in conversation