BookmarkSubscribeRSS Feed
rykwong
Quartz | Level 8

Dear all,

I have this logistic regression model and would like to extract the p value of the interaction term "drug*var1".

 

proc glm data=test;

model bodyweight = drug var1 drug*var1;

run;

 

 

Problem is I need to do this 600 times because there are var1, var2, var3.....  .... var600.  Any thoughts appreciated!!

 

Raymond

5 REPLIES 5
data_null__
Jade | Level 19

Transpose the 600 variable to observations with and BY variable that IDs them.  Then run your program with BY statement.

rykwong
Quartz | Level 8

thanks for the quick reply

not sure if I understand fully and I have attached the screen shots of dataset and the transposed screenshot.

 

can u be more specific how to plug variable names into this regression model?

 

proc glm data=transposed;

model bodyweight= drug var1 drug*var1

run;


transposed.pngdataset.png
data_null__
Jade | Level 19

Don't show screen shots.  Include example data in your post that can me copied and pasted into a program.

 

rykwong
Quartz | Level 8

thanks again.

the dataset (call it dataset1) looks like this

  var1 var2 var3
patient1 10 1 1000
patient2 0 2 1400
patient3 30 3 1300
patient4 40 4

1600

 

 

after transposing it (call it dataset2), it looks like this and I added varname as the header

varname patient1 patient2 patient3 patient4
var1 10 0 30 40
var2 1 2 3 4
var3 1000 1400 1300 1600

 

 

How do I plug the variables (var1....var3) into the regression model?

thanks

 

data_null__
Jade | Level 19

Run this example and study how it works.

 

proc transpose data=sashelp.class out=class;
   by name age sex;
   var height weight;
   run;
proc sort data=class;
   by _name_;
   run;
proc print;
   run;
proc glm;
   by _name_;
   class sex;
   model age= sex sex*col1;
   run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 5 replies
  • 1419 views
  • 0 likes
  • 2 in conversation