Overview
These instructions focus on how to download and use the SAS Macros we have available at our Useful SAS Macros page. The Statistical Consulting Group at ATS has created a set of %net tools designed to ease the process of downloading and using SAS macros. These tools allow you, from within SAS, to view the list of macros stored at our web site, view information about the macros, and download the macro(s). (Those familiar with Stata will see that this system for delivering macros was inspired by Stata and how it has built in commands to facilitate the sharing and delivery of Stata programs over the web.) When you download the macros, they are stored in a Personal Macro Folder of your choosing where SAS can find and load them. This document describes this set of macros and how you can download and use them. Note: In this documentation we coin a number of terms (like Personal Macro Folder) which are underlined and you can click on them to see their definition on our glossary page.
Once you have followed the steps for installing the %net tools, the following macros will be available for you to use. You can click on the name of the macro for documentation on the use of the macro.
%net_list | List packages stored on a web server |
%net_describe | Describe a package stored on a web server |
%net_help | Get help for a macro stored on a web server |
%net_get | Download files in a package from a web server |
%net_use | Copies a SAS data file from a web server to your local computer |
%net_copy | Copies a file from a web server to your local computer |
%net_update | Updates the net utilities from the UCLA ATS web server |
%local_list | List packages you have downloaded |
%local_describe | Describe a package you have downloaded |
%local_help | Get help for a macro you have downloaded |
Installing the %net tools
You can install the %net tools by following the steps below.
- Start SAS (version 8 or higher)
- Click on the %net tools installation program
- Copy and paste the entire contents into the SAS program editor (e.g. from your web browser choose Edit then Select All then Edit then Copy and then open the SAS program editor and choose Edit then Paste)
- Submit the program (e.g. by clicking on the running person).
- When you are asked for the folder you want to use as your Personal Macro Folder, you can accept the default location (c:sasmacros) or enter a location of your choosing. This folder will be where your downloaded SAS macros will be stored. Then, the %net tools will be downloaded to your computer into the folder you specified (if this folder does not exist, it will be created for you). Your autoexec.sas file will be modified (or created) adding a couple of lines that indicate where your Personal Macro Folder should be located and expanding the search path for sasautos so SAS will automatically look in your Personal Macro Folder for your macros.
Quick Example Session #1
In this example session, we look at the packages listed at a site, describe the package, view the help file for the package, and then download the package. You don’t need to go through all of these steps, but this shows the different kinds of information you can get before downloading a package.
We start by listing the packages available at https://stats.idre.ucla.edu/stat/sas/macros/ .
%net_list( https://stats.idre.ucla.edu/stat/sas/macros/ )
Once you see the list of packages that can be downloaded, say you want more information about test, so you use %net_describe for more information. Since https://stats.idre.ucla.edu/stat/sas/macros/ was the last site we visited, the macro will default to this location.
%net_describe( test )
We can show the help file using %net_help
%net_help( test )
We decide we would like to download the file, we can then use %net_get to download it.
%net_get( test )
Now, we can run the macro like this.
%test
Quick Example Session #2
In this example session, we want to download the package test and download it, look at the help for it, and run it.
%net_get( test, https://stats.idre.ucla.edu/stat/sas/macros/ )
Now we look at the help file for %test before running it.
%local_help( test )
Now we can run %test
%test