Help using Base SAS procedures

Mean adjustment question

Reply
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;

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!

Super User
Posts: 17,808

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.

Respected Advisor
Posts: 4,644

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;

  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
Ask a Question
Discussion stats
  • 2 replies
  • 201 views
  • 0 likes
  • 3 in conversation