Date: Wed, 3 Oct 2001 09:01:16 -0700
Reply-To: Dale McLerran <dmclerra@MY-DEJA.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dale McLerran <dmclerra@MY-DEJA.COM>
Subject: Re: IMLMLIB Module Library
Content-Type: text/plain
Carlos,
No, the documentation of the IMLMLIB library is pretty clear that
only SI is able to modify the contents of the IMLMLIB library.
Here is what the documentation says about that:
IML enables you to store and load matrices and modules in your
own STORAGE library (refer to the chapter on storage features
in SAS/IML Software: Usage and Reference, Version 6, First
Edition). The IMLMLIB library is different from this STORAGE
library. IMLMLIB contains predefined modules that can be loaded
only by IML.
The STORAGE library, on the other hand, is under the control of
the user. You can store and load both matrices and modules. The
STORE, LOAD, REMOVE, and RESET STORAGE commands apply only to the
STORAGE library. You cannot store additional modules in IMLMLIB.
The last line there indicates that no modification can be made to
the IMLMLIB library. If you cannot store additional modules in
IMLMLIB, then you should not be able to alter the IMLMLIB contents.
Thanks for the language lesson! I hate to say that my question
about "Why L?" illuminates my English-centric mindset. It never
even occurred to me that there might be a language basis for the
use of L.
Dale
>Date: Fri, 3 Oct 1997 11:51:52 +0100
>Reply-To: Carlos Tadeu <ctadeu@NOETHER.EX.AC.UK>
> Carlos Tadeu <ctadeu@NOETHER.EX.AC.UK> Re: IMLMLIB Module Library SAS-L@LISTSERV.UGA.EDU
>Dale,
>Than you very much for you reply. The 'stdize' function is working very
>well. I use L to hold the number of rows because my first language is
>Portuguese and 'Linha' is row in English. Sorry about this. But I am
>wondering if we can use the GLOBAL options in STANDARD function. Any idea?
>Carlos Tadeu
>
>----- Original Message -----
>From: "Dale McLerran" <dmclerra@my-deja.com>
>To: <ctadeu@maths.ex.ac.uk>; <sas-l@listserv.uga.edu>
>Sent: Tuesday, October 02, 2001 9:40 PM
>Subject: RE: IMLMLIB Module Library
>
>
>> Carlos,
>>
>> Just to follow up on what I previously wrote, I took another look
>> for the STANDARD function source code in the IMLMLIB library. This
>> time I found it. It is, indeed, just as I stated it to be, a
>> function in which the matrices MEAN and STD are not globalized.
>> This means that the matrices are available only during the execution
>> of the STANDARD function. Having found the source code, it is easy
>> to modify it so that the statistics you desire are available after
>> the function has completed. I demonstrate below a revised function
>> which is stored in the catalog SASUSER.IMLSTOR. The function is
>> then made available in a new IML session by loading the function
>> from the catalog.
>>
>> The function STDIZE performs exactly the same operations as the
>> function STANDARD. The only difference is that I have added
>>
>> GLOBAL (mean, std)
>>
>> to the START statement.
>>
>>
>> proc iml;
>> /*---------------------------------------------------------------*
>> * *
>> * MODULE TO STANDARDIZE DATA *
>> * *
>> * INPUT : x = n x m matrix where *
>> * n = number of data points *
>> * m = number of variables *
>> * *
>> * OUTPUT: returns standardized data (n x m) *
>> *---------------------------------------------------------------*/
>>
>>
>> start stdize (data) global (mean,std);
>> x = data; * to keep data intact;
>> n = nrow(x); * number of data points;
>> mean = x[:,]; * column(variable) means;
>> x = x - repeat(mean,n); * center x to mean zero;
>> ss = x[##,]; * sum of squares for columns;
>> std = sqrt(ss/(n-1)); * standard deviation estimate;
>> x = x*diag(1/std); * scaling to std dev 1;
>> return (x);
>> finish;
>>
>>
>> /* Next two commands allow us to store the function for later use */
>> reset storage=sasuser.imlstor;
>> store module=stdize;
>>
>> quit;
>>
>>
>>
>>
>> /* Demonstrate use of the STDIZE function in a new IML session */
>> proc iml;
>>
>> X={77.3 13.0 9.7 1.5 6.4,
>> 82.5 10.0 7.5 1.5 6.5,
>> 66.9 20.6 12.5 2.3 7.0,
>> 47.2 33.8 19.0 2.8 5.8,
>> 65.3 20.5 14.2 1.9 6.9,
>> 83.3 10.0 6.7 2.2 7.0,
>> 81.6 12.7 5.7 2.9 6.7,
>> 47.8 36.5 15.7 2.3 7.2,
>> 48.6 37.1 14.3 2.1 7.2,
>> 61.6 25.5 12.9 1.9 7.3,
>> 58.6 26.5 14.9 2.4 6.7,
>> 69.3 22.3 8.4 4.0 7.0,
>> 61.8 30.8 7.4 2.7 6.4,
>> 67.7 25.3 7.0 4.8 7.3,
>> 57.2 31.2 11.6 2.4 6.5,
>> 67.2 22.7 10.1 3.3 6.2,
>> 59.2 31.2 9.6 2.4 6.0,
>> 80.2 13.2 6.6 2.0 5.8,
>> 82.2 11.1 6.7 2.2 7.2,
>> 69.7 20.7 9.6 3.1 5.9};
>>
>> XO=X;
>> L=NROW(X); N=L; /* not sure why you use L to hold # of rows of X */
>> C=NCOL(X);
>>
>> means = x[:,];
>> diffs = x - repeat(means,l,1);
>> ssq = diffs`*diffs;
>> var = ssq/(n-1);
>> stdev = (sqrt(vecdiag(var)))`;
>>
>> print means;
>> print ssq;
>> print var;
>> print stdev;
>>
>> reset print;
>> reset storage=sasuser.imlstor;
>> load module=stdize;
>> X=stdize(X);
>> print mean;
>> print std;
>>
>> quit;
>>
>>
>> Hope this helps.
>>
>> Dale
>>
>>
>>
>>
>> ---------------------------------------
>> Dale McLerran
>> Fred Hutchinson Cancer Research Center
>> mailto: dmclerra@fhcrc.org
>> Ph: (206) 667-2926
>> Fax: (206) 667-5977
>> ---------------------------------------
>>
>> ------------------------------------------------------------
>> --== Sent via Deja.com ==--
>> http://www.deja.com/
>>
---------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
mailto: dmclerra@fhcrc.org
Ph: (206) 667-2926
Fax: (206) 667-5977
---------------------------------------
------------------------------------------------------------
--== Sent via Deja.com ==--
http://www.deja.com/
|