RASMacro open-source, free-software library



RASmacro library
SAS macros for BUGS (subset of RASmacro library)

List of SASŪ Macros and Short Descriptions


TIGERADJACENT: create adjacency information for ZIP codes and Census Tracts.
TIGERGEOCODE : geocode addresses according to TIGER/Line files.
TIGERIMPORT  : import TIGER/Line files from the US Census Bureau.
_ABEND  :  Abend your jobs with specified return codes. 
_ARRAY  :  Create 1 to 3 dimensional arrays from previously defined variables. 
_BLIST  :  Expand a single/double-hyphen or colon variable list.
_BY     :  Create a BY statement appropriate for either a DATASET or a PROC. 
_CATEXT :  Return the CATALOG file name extension.    
_CD     :  Change directory.    
_CEXPORT:  Export a CSV file for Excel/Stata.    
_CIMPORT:  Import a CSV file from Excel/Stata.    
_CJ     :  Left justify, right justify, and/or center text.    
_COUNT  :  Count the number of arguments in a list.    
_DATA   :  Return the DATASET name from a one-level or two-level name with or without options.    
_DATATYP:  Extend DATATYP macro capabilities to lists.    
_DEBUGS :  Summarize posterior samples.    
_DECODA :  Import CODA data files.    
_DELETE :  Delete CATALOGs, DATASETs and the associated index file, if any.    
_DIR    :  Pad directory name with appropriate directory character.    
_DIRCHAR:  Return appropriate directory character.    
_DSEXIST:  Check for the existence of a DATASET. 
_DUMMY  :  Create dummy variables. 
_EXIST  :  Check for the existence of a file.    
_FILE   :  Strip quoting, if any.    
_FILEREF:  Create a FILEREF from file names with wild cards.    
_FIRST  :  Find the first observation with or without BY group processing.    
_FN     :  File information about the source code that is being processed.    
_FOOT   :  Create macro variables for footnotes from the DICTIONARY.    
_HEAD   :  Return a list without it's tail (see also _TAIL).    
_IFELSE :  Perform an operation, conditionally, based on a boolean value.    
_IN     :  Create an IN() logical operator after expanding hyphenated lists.    
_INDEXC :  Macro imitation of the INDEXC function. 
_LAST   :  Find the last observation with or without BY group processing.    
_LEVEL  :  Create a list of values from a DATASET.    
_LEXPORT:  Export "list" data file for BUGS/R/S+.    
_LIB    :  Return the LIBNAME from a one-level or two-level name.    
_LIMPORT:  Import "list" data file from BUGS/R/S+.    
_LIST   :  Expand a single hyphen argument/variable list.    
_LJ     :  Left justify text.    
_LS     :  Returns the current LINESIZE. 
_MAX    :  Macro imitation of the MAX function.    
_MIN    :  Macro imitation of the MIN function.    
_NOBS   :  Return the number of observations in a DATASET. 
_OPTION :  Return the DATASET options supplied with a DATASET name.    
_PAD    :  Pad a text string. 
_PRINTTO:  Re-direct the LOG and/or LISTING.    
_PS     :  Return the current PAGESIZE. 
_REORDER:  Re-parameterize variables for a specified ordering, but maintain the original values with FORMATs.    
_REPEAT :  Similar to the REPEAT function.    
_REQUIRE:  Ensures that a REQUIRED parameter has been specified.    
_RETAIN :  Similar to RETAIN, except the variables are re-initialized at the beginning of each BY group.    
_RJ     :  Right justify a text string.    
_SCRATCH:  Return a temporary DATASET.    
_SEXPORT:  Export "structure" data file for BUGS or R/S+. 
_SORT   :  SORT a DATASET if a BY statement is supplied, COPY otherwise.    
_SUBSTR :  Robust version of SUBSTR.    
_SUFFIX :  Return a list of file extensions for a DATASET and an index file.    
_SUMMARY:  Create tables with statistics from PROCs FREQ, MEANS, UNIVARIATE, etc.    
_TAIL   :  Return the tail of list (see also _HEAD).    
_TITLE  :  Make macro variables of the current titles from the DICTIONARY.    
_TR     :  Similar to the TRANSLATE function.    
_TRANSPO:  Something like the opposite of PROC TRANSPOSE.    
_UNWIND :  For OS-dependent macro programming. 
_VERSION:  For version-dependent macro programming.    
_WHEN   :  Similar to the IN operator, but more flexible.    

Quick and Dirty Installation instructions
For more complete and advanced instructions go here

To install these SAS macros, do as follows:
1. unzip them into a directory denoted by ?????? (use the actual name)
2. edit your SAS configuration file, sasv8.cfg, sasv9.cfg (Windows) or sasv9_local.cfg (Unix/Linux)

2a. you probably have a line something like the following:

-sasautos '!SASROOT/sasautos'                   /* for Unix/Linux */>

-sasautos '!SASROOT\core\sasmacro'              /* for Windows    */
2b. edit or add the corresponding line as follows:

-sasautos ( '!SASROOT/sasautos' '??????' )      /* for Unix/Linux */

-sasautos ( '!SASROOT\core\sasmacro' '??????' ) /* for Windows    */
3. now, call the SAS macros from your SAS program like:
%_decoda(out=dataset, chains=2, infile=coda); 
%_limport(infile=alc.tbl, file=import.sas, out=alc);
%_lexport(file=alc.txt, data=alc, var=status alcgrams);
%_sexport(data=matrix, var=col1-col5, file=m.struct);
My contact info
Last modified: Tue Jul 29 15:15:43 CDT 2008