BookmarkSubscribeRSS Feed
jfine73
Calcite | Level 5

Hello, I'm kinda new to the statistical world and am working with SAS to do a data analysis.

I know that I have a dependent variable based on age and bmi and I want to do a mean adjustment of the dependent variable based on these two independent variables.

proc reg only shows that they are, in fact, predictor variables. Also, N = 150

code so far:

proc reg data=test;

model depvar = age bmi / cbi;

run;

So I know that the dependent variable is based off of age and bmi. I'm, just not sure what code to use to actually adjust the values of the dependent variable based on them. Any help would be appreciated. Thanks!

2 REPLIES 2
Reeza
Super User

Figure out what your output should be and then it becomes a question of how to get SAS to be. Generally a good solution with stats question.

I'd find an example of what you need online, a stats paper or something and then use that as a reference trying to recreate it. Once you can do that, then you move on to your actual data.

PGStats
Opal | Level 21

I am not certain I understand what kind of adjustment you require but I have met the

situation where the effect of covariables had to be subtracted from the dependent variable,

which can be done in the following way :

/* Define reference age and BMI */

%let refAge=30;

%let refBMI=20;

/* Add one observation with reference age and BMI to the dataset */

data refTest;

if _n_=1 then do;

  age = &refAge;

  bmi = &refBMI;

  output;

  end;

set test;

output;

run;

/* Get the predicted values (including for the reference age and BMI) and individual residuals */

proc reg data=refTest;

model depvar = age bmi / clb;

output out=outTest r=resid p=pred;

run;

/* Compute adjusted dependent variable as predicted dependent variable at reference age and BMI

plus individual departure from regression mean (the residual) */

data testAdj;

set outTest;

if _n_=1 then refDepvar = pred;

else do;

  stdDepvar = refDepvar + resid;

  output;

  end;

drop refDepvar;

run;

(Not tested)

PG

PG

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 758 views
  • 0 likes
  • 3 in conversation