turn on suggestions

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

Showing results for

Find a Community

Topic Options

- 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

07-21-2010 06:39 PM

Hi,

I'm trying to run a LMS regression in SAS/IML, and can successfully get it to run, but I am having trouble controlling the output. I have 15 independent variables and need the output labeled, but it comes out as var1, var2, etc.

Here is what I have:

proc iml ;

use WORK.auto;

read all var {&input &model1} into model1;

title "MODEL 1";

title2 "5% CENTRALITY BY VALUE";

a = model1[1:59,2:16];

b = model1[1:59,1];

optn = j(8,1,.);

optn[2]= 1;

optn[3]= 1;

optn[8]= 1;

call lms(sc,coef,wgt,optn,b,a);

close work.auto;

quit;

If anyone knows how to get the parameter estimates etc in the output to have the variable names, please let me know.

Thanks!

I'm trying to run a LMS regression in SAS/IML, and can successfully get it to run, but I am having trouble controlling the output. I have 15 independent variables and need the output labeled, but it comes out as var1, var2, etc.

Here is what I have:

proc iml ;

use WORK.auto;

read all var {&input &model1} into model1;

title "MODEL 1";

title2 "5% CENTRALITY BY VALUE";

a = model1[1:59,2:16];

b = model1[1:59,1];

optn = j(8,1,.);

optn[2]= 1;

optn[3]= 1;

optn[8]= 1;

call lms(sc,coef,wgt,optn,b,a);

close work.auto;

quit;

If anyone knows how to get the parameter estimates etc in the output to have the variable names, please let me know.

Thanks!

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

07-22-2010 01:25 PM

The variable names in the ODS tables are obviously being hard-coded as VAR1-VAR16, and I don't think you can change that portion of the output. The problem, of course, is that the LMS routine takes a matrix of explanatory variable (your 'a' matrix), so it actually doesn't know the names of the data set variables from which the matrix was created.

It would be a good idea to extend the LMS routine to provide the functionality you want.

You can, however, use ODS output to save the tables to a data set and then use the DATA step or PROC IML to rename the variables. If you are interested in that, here is some sample code:

%let input = MPG_Highway;

%let model1 = EngineSize Horsepower Weight Length;

proc iml ;

use Sashelp.cars; /* you'll have this if you have SAS/GRAPH */

read all var {&input &model1} into model1;

close Sashelp.cars;

a = model1[,2:ncol(model1)];

b = model1[,1];

optn = j(8,1,.);

optn[2]= 1; optn[3]= 1; optn[8]= 1;

*ods trace on / listing;

ods output EstCoeff=ParamEst; /* write one or more tables to data sets */

call lms(sc,coef,wgt,optn,b,a);

ods output close;

/* read data with names 'VAR1':'VARn' and 'Intercep' */

use ParamEst;

read all var _NUM_ into x[colname=oldVarNames];

close ParamEst;

/* rewrite data with new names */

varNames = {&model1} || "Intercep";

create ParamEst from x[colname=varNames];

append from x;

close ParamEst;

quit;

proc print data=ParamEst;

run;

It would be a good idea to extend the LMS routine to provide the functionality you want.

You can, however, use ODS output to save the tables to a data set and then use the DATA step or PROC IML to rename the variables. If you are interested in that, here is some sample code:

%let input = MPG_Highway;

%let model1 = EngineSize Horsepower Weight Length;

proc iml ;

use Sashelp.cars; /* you'll have this if you have SAS/GRAPH */

read all var {&input &model1} into model1;

close Sashelp.cars;

a = model1[,2:ncol(model1)];

b = model1[,1];

optn = j(8,1,.);

optn[2]= 1; optn[3]= 1; optn[8]= 1;

*ods trace on / listing;

ods output EstCoeff=ParamEst; /* write one or more tables to data sets */

call lms(sc,coef,wgt,optn,b,a);

ods output close;

/* read data with names 'VAR1':'VARn' and 'Intercep' */

use ParamEst;

read all var _NUM_ into x[colname=oldVarNames];

close ParamEst;

/* rewrite data with new names */

varNames = {&model1} || "Intercep";

create ParamEst from x[colname=varNames];

append from x;

close ParamEst;

quit;

proc print data=ParamEst;

run;

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

07-23-2010 12:48 PM

Thanks!