top of page

Getting Started

To get started using M2SLink, we recommend the following.

After you run the installer, use the File Explorer to navigate to the following directory:

C:\Program Files\Harper Corditt Software\M2SLink 3.0\Documentation


Double-click on the file named M2SLink User Guide.pdf.  This document is your complete reference guide for using M2SLink; its first sections provide the basic information you need to get started using M2SLink.

After you open the M2SLink User Guide.pdf file, you should navigate to the following directory:

C:\Program Files\Harper Corditt Software\M2SLink 3.0\Notebooks

Double-click on the Mathematica notebook named M2SLink User Guide.nb.

This will launch Mathematica and after a few seconds, Mathematica will open a window that displays the contents of the M2SLink User Guide.nb notebook.  The M2SLink User Guide.nb notebook contains executable code for every example that is described in the M2SLink User Guide.pdf file.

Next, in the M2SLink User Guide.nb notebook, scroll down to the initialization cell (colored light gray - see below ) and click on the vertical line to the right.  The vertical line will become high-lighted as shown:

initialization section.PNG

Press the Enter key.  Mathematica will evaluate the lines in the initialization cell.  As a result, Mathematica will recognize the various paths that are defined in the initialization cell when it encounters these strings elsewhere in the notebook.  You may need to modify the lines above if you have installed M2SLink in a location other than the default or if the path to your SAS executable is different.

The last two lines of the initialization section add the M2SLink installation directory to the $Path global symbol and read in the M2SLink.wl file.  Before you install the M2SLink add-on in your notebook for the current session, you should always perform these two steps.  You only need to do these two steps once per session.

You should now work your way through the first few sections of the M2SLink User Guide.pdf file, to learn how to start a SAS session and how to import a SAS data set.  As you come to each example described in the PDF document, try executing the corresponding lines in the companion M2SLink User Guide.nb notebook.

To get started, load the M2Slink add-on into your notebook by evaluating the Install function:


Next, start a SAS session by evaluating the M2SStartSAS function as shown:


You can now import any SAS data set directly into your Mathematica notebook, export a Mathematica list to a SAS data set, or submit a SAS program and view the results in your notebook.


For example, to import the class data set, which is one of the sample data sets provided by SAS in the SASHELP library, evaluate the M2SImport function and specify the LibDotMember option as shown:


The M2SImport function returns a 2-part list.  The first part is a list of rules that provide metdata for the imported SAS data set.  The second part is a Mathematica Dataset object that encapsulates the list of imported observations.  You can now use Mathematica's powerful Dataset functionality to view and analyze your data.

If your SAS data set resides in a file on disk, you can use the Path option when you evaluate the M2SImport function to import your data set.  M2SLink provides several sample SAS data sets in the SAS sample data sub-directory of the installation directory.

So for example, we can import the staff data set, specifying the Path option as shown:


Whenever you are done using M2SLink, you should evaluate the Uninstall function:


When you have questions, consult the M2SLink User Guide.pdf file.  Help is also available from within your notebook using Mathematica's "?" query mechanism.

You can also find the complete M2SLink User Guide on our Downloads page.

You may also want to watch our YouTube video for M2SLink.

bottom of page