SASPrograms by User


The SAS macros and programs listed below, were found on discussion group SAS-L or newsgroup comp.soft-sys.sas. They were developed by SAS users worldwide. The authors are noted within the macro or program source.

There is a SAS Macro Tutorial written by Clarence Jackson.

Frequently asked Questions about Macro Facility by SAS Institute Inc.

Note: some SAS macros listed here,
      need a specific name of a
      subdirectory for creating
      an output file. Please take a
      look at the statements LIBNAME,
      FILENAME, FILE, or %LET there.

The following list is sorted alphabetically by macronames. The scope of application is given, also the date and size information. The list is sorted alphabetically by macronames. You can also use a Search utility to search this collection.

   Name    Date   

Size [Kbyte]

 Description
AGE 15-Aug-96 0.750    Formula for age calculation
ANAL_LOG 30-Nov-95 2.720    This is a simple macro which reads saved SAS logs. It extracts information about downloads and keeps the information in a dataset. It then produces 4 graphs using this information and another graph (combining the 4 graphs on one page) is sent to the printer
ANNOMAC 15-Jan-88 14.530    Annotate support macros
BLCK-SEL 17-May-96 0.224    Shows how to select a block of a data set for printing
CALCOMP 08-Dec-93 0.630    CALCOMP GDEVICE entry
CAT2GSF 24-Apr-96 1.890    Generates graphic stream files
CHECK 31-Oct-95 2.726    Checks the existence of a SAS data set and the existance of character variables
CHEK-SAS 22-Feb-96 2.097    Checks whether numeric or character variable type
CHK-DS 25-Jul-96 1.407    Checks the existance of an SAS data set and looks for number of observations.
CHK-FILE 12-Jul-96 1.100    Checks the existance of a file. It works with SAS version 6.11 in Windows
CHK-FN 12-Jan-96 0.453    Tests whether a file exists. It works with AIX 3.2 UNIX
COLLIN 07-Aug-95 6.632    Multicollinearity diagnostics (TOL VIF COLLIN)
COLORS 13-Nov-95 1.790    Displays colors
COMMA 07-Aug-95 1.580    Produces an ASCII file from a given SAS data set with delimiter Comma
CSV 24-Nov-97 1.370    Produces an ASCII file from a given SAS data set with delimiter Comma, values are also enclosed with quotes (for direct import into Excel)
DATADOC 31-Oct-95 8.110    Documents SAS data sets
DB-2-SAS 08-Feb-97 4.729    Converts dBase file into SAS data set (from SAS Institute BBS)
DBTOSAS 24-Apr-96 4.510    Converts dBase file into SAS data set
DECILE 07-Aug-95 19.020    Calculates decile shares etc. for variable y with weight w (gini coefficients are also calculated)
DRAW 07-Apr-95 0.440    Draws a line (annotates data set)
DT-DAY 14-Jan-96 2.399    Plots datetime format with truncated axis values
DUMMY 15-Jun-96 2.600    Creates an SAS data set with dummy variables
EASYTRIV 31-Oct-95 9.760    The essence of this macro is to skip the reformatting of the data to SAS data sets and to deal simply with sorted flat files for these basic operations
EQUATE 19-Apr-96 5.480    Creates a GPLOT with distances equated on both axes
EXC2SAS 01-Feb-96 1.133    Taking MS Excel data into SAS
EXCtoSAS 02-Jul-98 3.350    MS Excel to SAS: workbooks with multiple worksheets
FILENAMES 31-Jan-97 1.700    Getting date of filenames (UNIX)
FLATOUT 30-Mar-96 3.362    Generates a tab delimited flat file from a valid SAS data set or view. The flat file is created in a default directory under the same name as the data set or view (lowercase in UNIX) with the extension '.txt'. (SunOS, SAS 6.11)
FRM2HTML 31-Mai-96 5.084    Creates an HTML document from SAS format library
GITTER 24-Apr-96 3.450    Creates annotates data set which puts grid lines on the map
GRFTREE 24-Apr-96 25.200    Draws dendrogramms with output from proc CLUSTER
GRID 07-Aug-95 8.440    Replays multiple graphs on a regular grid on one graph
IRISVRML 14-Nov-95 4.860    SAS program which makes an VRML file from SAS x y z data
ISMAP 24-Apr-96 5.280    An SAS program which generates input sensitive maps using SAS proc GMAP. If you have a map data set and this SAS program, you can make Web pages with that map and each object on the map can have a clickable link
JUSTIFIED 25-Jul-96 1.300    Left, center, or right justify titles in ordinary SAS output
KAPPA 18-Oct-94 3.035    Calculates the Kappa's Statistic
MAKEATTR 31-Oct-95 2.910    Writes SAS codes to recreate data sets. Useful for inserting and modify variables
MAKEDIR 26-Jan-96 3.117    Dynamically allocats directory
MAKEFILE 26-Jan-96 1.250    Creates files with different filenames
MAKEFMT 26-May-94 5.218    Creates FORMATS from SAS data sets
MAKEFMT_T 02-Jan-97 21.823    This macro constructs source code for value formats and informats
METATATE 04-Nov-93 27.570    Creates an annotate data set to reproduce graphics
MOVE 07-Apr-95 0.320    Moves to a point without drawing a line (annotate data set)
OVERLAY 04-Dec-97 2.0    SAS Graph Overlay for Proc GPLOT
PAIRWISE 24-Apr-96 17.400    Creates a page of pairwise comparison plots. This macro only works for data sets with at least five continuous numeric variables to plot
PERMU 24-Apr-96 1.190    Produces all permutations, only works for a string up to 9 characters long
PERMUTE 24-Apr-96 4.680    Macro obtains the combinations and permutations of n items taken k at a time. Original source was published by SAS Communications
PRINTG 11-Feb-97 5.200    Macro to setup graphic device parameters for writing to file or hard printing
PROJECT 20-Sep-97

  2.55

Shows range of new undocumented map projections available in Proc Gproject (SAS/Graph) for version 6.12.
RANK 31-Oct-95 1.610    The macro is essentially implementing 'proc rank group=QUANTILES' with a weight statement
REORDER - 0.126    Shows, how to reord variables within an SAS data set
SAS2EXCEL 10-Feb-97 1.070    Exporting SAS (win 6.11) data set to Excel
SASTOEXCEL 15-Jan-98 1.600    Exporting SAS data set to Excel in Windows
SAS-HTML 20-May-96

12.600  

Generates an HMTL table from an SAS data set (OBS column is also present)
SAS2HTML 11-Apr-96

 4.760  

Generates an HTML table from an SAS data set
SAS2LaTeX 15-Mar-96 44.336   Generates LaTeX tables from an SAS data set, including formats, ...
SAS2LaTX2 07-Oct-97 44.500   Generates LaTeX tables from an SAS data set (other version)
SASDBF 31-Oct-95 7.790    Converts dBase file into SAS data set (Ver 2.1)
SASTO123 31-Oct-95 2.070    Converts SAS data set into LOTUS 1-2-3 input
SCALE01 - 2.076    Scales each variable to range from Lo to Hi
SCL_SCAN 31-Oct-95 5.360    Reads SAS AF catalogues and dumps its source code into ASCII files
SHADED_B 24-Apr-96 0.900    Generates a shaded background
SPLIT 30-Mar-95 2.438    Reads a record and then depending upon the value of a keyword, writes that record into an SAS data set whose name is the matching keyword value
SPLTSAS 10-Apr-95 8.601    Partitions of SAS data sets
STRCNT 12-Dec-96 2.272    Counts the number of words
TOBIT 15-May-97 1.000    Estimating Tobit Model
TODAY 05-Jun-97 0.338    Put today's date into a filename
UNISTATS 19-Nov-97 7.100    Calculates univariate statistics and provides a dataset with one observation per variable, which allows an output similar to PROC MEANS
USERID 10-Apr-97 1.230    Find out userid
VARNUM 07-Feb-96 0.771    Looks for the number of variables in an SAS data set
WEEK 08-Apr-96 0.765    Determines which week of the year
WORD2SAS 22-Jan-96 9.930    Converts tables from MS Word 6.0 to SAS within MS Windows
WORDWRAP 22-Apr-96 7.123    SUGI Programmers Toolkit Update
XMACRO 19-Apr-96 74.004   Utility routines for proc-like macros