I have created a SAS/IML library with scores of modules using SAS/Studio OnDemand. I want to download this library to my Windows 11 PC. I used the SAS/Studio download function to send the file to my PC, where it was received successfully. But when I try to access it using the following code:
libname Subtract 'C:\Users\RossMaster\Documents\My SAS Files\Subtractive Clustering\SASCode' ;
proc iml ;
reset storage=Subtract.fuzzylib ;
show storage ;
quit ;
then the process fails because PC SAS does not recognize the contents of the library. Do I use PROC ENCODE to encode the library for transport in SAS/Studio and then use PROC DECODE to create a new library on the PC? Is there another way?
Ross
When you create an IML library of functions, you start with the SOURCE CODE, which is the set of text files that contains the module definitions. When you use the STORE statement, the source code is compiled and stored in binary form in a SAS catalog. SAS catalogs are not compatible across operating systems or releases, which means that you cannot transfer a catalog compiled on Linux under some SAS release and expect to read it on Windows in another SAS release.
What you should do is transfer the SOURCE CODE files to your PC. Read them into PROC IML and use the STORE statement to create a catalog for your Windows 11 PC.
When you create an IML library of functions, you start with the SOURCE CODE, which is the set of text files that contains the module definitions. When you use the STORE statement, the source code is compiled and stored in binary form in a SAS catalog. SAS catalogs are not compatible across operating systems or releases, which means that you cannot transfer a catalog compiled on Linux under some SAS release and expect to read it on Windows in another SAS release.
What you should do is transfer the SOURCE CODE files to your PC. Read them into PROC IML and use the STORE statement to create a catalog for your Windows 11 PC.
Thanks, Rick. I will use your approach. Because I have lots of modules to compile, is there any easy way that I can compile each module and store it in a SAS/IML library? Or do I need to run SAS/IML on each individual file containing a module definition?
Ross
There are several ways to organize a library of functions. Back in 2013, I wrote this article: How to create a library of functions in PROC IML - The DO Loop
I am going to guess that you have dozens of physical files, which I will call Def1.sas, Def2.sas, Def3.sas, etc. The two main ways to organize the code is
I tend to use the second method because I can work on and test components independently. So, here's the way I usually do it:
/* ------ Def1.sas FILE ----- */
start MyMod1(x); ... finish;
start MyMod2(x); ... finish;
start MyMod3(x); ... finish;
store module = (
MyMod1
MyMod2
MyMod3
);
/* ------ Def2.sas FILE ----- */
start MyMod4(x); ... finish;
start MyMod5(x); ... finish;
start MyMod6(x); ... finish;
store module = (
MyMod4
MyMod5
MyMod6
);
/* ------ DefineAll.sas FILE ----- */
%let path = path/to/my/modules;
proc iml;
%INCLUDE "&path/Def1.sas";
%INCLUDE "&path/Def2.sas";
QUIT;
Then, when I want to use the modules, I do this:
%include "DefineAll.sas"; /* stores all modules */
proc iml;
load module=_all_;
y = MyMod1(1234);
z = MyMod6(4321);