Solved
Contributor
Posts: 45

# Need help with proc iml

Hi, everyone.

I need to do a median regression and I believe I should use the procedure iml, which I know nothing about. Below is a sample code I had found online at http://www.ats.ucla.edu/stat/sas/webbooks/reg/chapter4/sasreg4.htm and I need your help in understanding what they are. My comments are in blue color.

proc iml ; /*Least absolute values*/
use elemapi2;                                I think elemapi2 is the dataset
a = cons || acs_k3 || acs_46 || full || enroll;                 so a is the independent variables set. cons is the constant, acs_k3, .... and enroll are all independent variables.
b=api00;                                                                   api00 is the dependent variable
opt= { . 3 0 1 };                                                          opt seems to mean output, but I have no idea what
{ . 3 0 1 } is. HELP!
call lav(rc,xr,a,b,,opt); /*print out the estimates*/                what is rc and xr? Does opt mean to print out the estimates?

opt= { . 0 . 1 };                                                                opt again.
{ . 0 . 1 } seems to mean something different from { . 3 0 1 } . What is it?

call lav(rc,xr,a,b,,opt); /*no print out but to create the xr*/

pred = a*t(xr);                                                        Calculate the predicted variable

resid = b - pred;                                                        calculate the residual

create _temp_ var { api00 cons acs_k3 acs_46 full enroll pred resid};                  create a dataset _temp_ to contain all variables, the predicted, and the residual

append;                                                          This seems to have something to do with the dataset just created

quit;

After this is run, the result is something like this.

L1 Solution with ASE

Est 17.1505029 1.2690656888 7.2240793844 5.3238408715 -0.124573396                           So the Est. here is the coefficients?

ASE 123.531545 6.3559394265 2.2262729207 0.602359504 0.0391932684                           And these are the standard errors?

I know these are really dumb questions. But I'm learning from zero. Thanks ahead for your help!

Accepted Solutions
Solution
‎04-20-2013 12:04 AM
Contributor
Posts: 45

## Re: Need help with proc iml

No one answered so far, so I did a google search and found this: SAS/IML(R) 9.2 User's Guide, and it answered most of my questions above, in case anyone sees this and has similar questions.

All Replies
Contributor
Posts: 45

## Re: Need help with proc iml

When I run my median regression, the SAS first shows me :

 LS Solution

 Est -96561.9 -0.2463 -2.6026 97924 181960 -4.30647

 LS Solution

 Est 458949 -95.9681 98394.1 2.60465 61681.5 -1.73802

After a bunch of LAV (L1) Estimation, which looks like a matrix, it gives me:

 L1 Solution with ASE

 Est 8766.72 -2.78873 0.59954 -213854 -15320.2 2.87805 ASE 5226.97 0.458972 0.494691 43854.3 11406.1 0.664384

 L1 Solution with ASE

 Est 40554.2 -6.86237 27982.1 2.65425 -5710.52 0.767282 ASE 45907.8 4.98149 7780.63 0.364518 7090.93 0.295003

The LS solution and L1 solution estimates are different. Which are the coefficients I want to use?

And, since I have coefficients and standard errors, I can calculate the t value. But if I want to know the p value, is this the same with OLS regression? I mean, how can I know the F value?

Solution
‎04-20-2013 12:04 AM
Contributor
Posts: 45

## Re: Need help with proc iml

No one answered so far, so I did a google search and found this: SAS/IML(R) 9.2 User's Guide, and it answered most of my questions above, in case anyone sees this and has similar questions.

Posts: 2,655

## Re: Need help with proc iml

While coding it all through IML is possible, this looks exactly like what PROC QUANTREG should give you.  Take a look at the documentation here:

http://support.sas.com/documentation/cdl/en/statug/63347/HTML/default/viewer.htm#qreg_toc.htm

Steve Denham

🔒 This topic is solved and locked.