Help using Base SAS procedures

Mean adjustment question

New Contributor
Posts: 3

Mean adjustment question

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;


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!

Super User
Posts: 23,771

Re: Mean adjustment question

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.

Esteemed Advisor
Posts: 5,539

Re: Mean adjustment question

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;



set test;



/* 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;


/* 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;



drop refDepvar;


(Not tested)


Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation