Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Mean adjustment question

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-10-2014 01:10 PM

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!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-10-2014 01:17 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-10-2014 06:23 PM

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