base Directory Reference

Regular Base SAS Macros.

More...

Detailed Description

These macros have the following attributes:

  OS independent
  Not metadata aware
  No X command
  Prefixes:  _mf_, _mp_

Macros starting mf_ are macro functions and can be used in assignment statements. Those starting mp_ are macro procedures, which generate SAS statements, and must therefore be applied accordingly.

Files

file  mf_abort.sas [code]
 Abort, ungracefully.
 
file  mf_dedup.sas [code]
 de-duplicates a macro string
 
file  mf_deletefile.sas [code]
 Deletes a physical file, if it exists.
 
file  mf_existds.sas [code]
 Checks whether a dataset OR a view exists.
 
file  mf_existfeature.sas [code]
 Checks whether a feature exists.
 
file  mf_existfileref.sas [code]
 Checks whether a fileref exists.
 
file  mf_existfunction.sas [code]
 Checks if a function exists.
 
file  mf_existvar.sas [code]
 Checks if a variable exists in a data set.
 
file  mf_existvarlist.sas [code]
 Checks if a set of variables ALL exist in a data set.
 
file  mf_fmtdttm.sas [code]
 Returns E8601DT26.6 if compatible else DATETIME19.3.
 
file  mf_getapploc.sas [code]
 Returns the appLoc from the _program variable.
 
file  mf_getattrc.sas [code]
 Returns a character attribute of a dataset.
 
file  mf_getattrn.sas [code]
 Returns a numeric attribute of a dataset.
 
file  mf_getengine.sas [code]
 Returns the engine type of a SAS library.
 
file  mf_getfilesize.sas [code]
 Returns the size of a file in bytes.
 
file  mf_getfmtlist.sas [code]
 Returns a distinct list of formats from a table.
 
file  mf_getfmtname.sas [code]
 Extracts a format name from a fully defined format.
 
file  mf_getgitbranch.sas [code]
 Retrieves the current branch from a local GIT repo.
 
file  mf_getkeyvalue.sas [code]
 retrieves a key value pair from a control dataset
 
file  mf_getplatform.sas [code]
 Returns platform specific variables.
 
file  mf_getquotedstr.sas [code]
 Adds custom quotes / delimiters to a delimited string.
 
file  mf_getschema.sas [code]
 Returns the database schema of a SAS library.
 
file  mf_getuniquefileref.sas [code]
 Assigns and returns an unused fileref.
 
file  mf_getuniquelibref.sas [code]
 Returns an unused libref.
 
file  mf_getuniquename.sas [code]
 Returns a shortened (32 char) GUID as a valid SAS name.
 
file  mf_getuser.sas [code]
 Returns a userid according to session context.
 
file  mf_getvalue.sas [code]
 Retrieves a value from a dataset. If no filter supplied, then first record is used.
 
file  mf_getvarcount.sas [code]
 Returns number of variables in a dataset.
 
file  mf_getvarformat.sas [code]
 Returns the format of a variable.
 
file  mf_getvarlen.sas [code]
 Returns the length of a variable.
 
file  mf_getvarlist.sas [code]
 Returns dataset variable list direct from header.
 
file  mf_getvarnum.sas [code]
 Returns the position of a variable in dataset (varnum attribute).
 
file  mf_getvartype.sas [code]
 Returns variable type - Character (C) or Numeric (N)
 
file  mf_getxengine.sas [code]
 Returns the engine type of a SAS fileref.
 
file  mf_increment.sas [code]
 Increments a macro variable.
 
file  mf_isblank.sas [code]
 Checks whether a macro variable is empty (blank)
 
file  mf_isdir.sas [code]
 Checks whether a path is a valid directory.
 
file  mf_isint.sas [code]
 Returns 1 if the variable contains only digits 0-9, else 0.
 
file  mf_islibds.sas [code]
 Checks whether a string follows correct library.dataset format.
 
file  mf_loc.sas [code]
 Returns physical location of various SAS items.
 
file  mf_mkdir.sas [code]
 Creates a directory, including any intermediate directories.
 
file  mf_mval.sas [code]
 Returns a macro variable value if the variable exists.
 
file  mf_nobs.sas [code]
 Returns number of logical (undeleted) observations.
 
file  mf_readfile.sas [code]
 Reads the first line of a file using pure macro.
 
file  mf_trimstr.sas [code]
 Removes character(s) from the end, if they exist.
 
file  mf_uid.sas [code]
 Creates a unique ID based on system time in friendly format.
 
file  mf_verifymacvars.sas [code]
 Checks if a set of macro variables exist AND contain values.
 
file  mf_wordsinstr1andstr2.sas [code]
 Returns words that are in both string 1 and string 2.
 
file  mf_wordsinstr1butnotstr2.sas [code]
 Returns words that are in string 1 but not in string 2.
 
file  mf_writefile.sas [code]
 Creates a text file using pure macro.
 
file  mp_abort.sas [code]
 abort gracefully according to context
 
file  mp_aligndecimal.sas [code]
 Apply leading blanks to align numbers vertically in a char variable.
 
file  mp_appendfile.sas [code]
 Append (concatenate) two or more files.
 
file  mp_applyformats.sas [code]
 Apply a set of formats to a table.
 
file  mp_assert.sas [code]
 Generic assertion.
 
file  mp_assertcols.sas [code]
 Asserts the existence (or not) of columns.
 
file  mp_assertcolvals.sas [code]
 Asserts the values in a column.
 
file  mp_assertdsobs.sas [code]
 Asserts the number of observations in a dataset.
 
file  mp_assertscope.sas [code]
 Used to capture scope leakage of macro variables.
 
file  mp_base64copy.sas [code]
 Convert a file to/from base64 format.
 
file  mp_binarycopy.sas [code]
 Copy any file using binary input / output streams.
 
file  mp_chop.sas [code]
 Splits a file of ANY SIZE by reference to a search string.
 
file  mp_cleancsv.sas [code]
 Fixes embedded cr / lf / crlf in CSV.
 
file  mp_cntlout.sas [code]
 Creates a cntlout dataset in a consistent format.
 
file  mp_copyfolder.sas [code]
 A macro to recursively copy a directory.
 
file  mp_coretable.sas [code]
 Create the permanent Core tables.
 
file  mp_createconstraints.sas [code]
 Creates constraints.
 
file  mp_createwebservice.sas [code]
 Create a web service in SAS 9, Viya or SASjs Server (legacy)
 
file  mp_csv2ds.sas [code]
 Efficient import of arbitrary CSV using a dataset as template.
 
file  mp_deleteconstraints.sas [code]
 Delete constraionts.
 
file  mp_deletefolder.sas [code]
 A macro to delete a directory.
 
file  mp_dictionary.sas [code]
 Creates a portal (libref) into the SQL Dictionary Views.
 
file  mp_dirlist.sas [code]
 Returns all files and subdirectories within a specified parent.
 
file  mp_distinctfmtvalues.sas [code]
 Creates a dataset containing distinct formatted values.
 
file  mp_dropmembers.sas [code]
 Drops tables / views (if they exist) without warnings in the log.
 
file  mp_ds2cards.sas [code]
 Create a CARDS file from a SAS dataset.
 
file  mp_ds2csv.sas [code]
 Export a dataset to a CSV file WITH leading blanks.
 
file  mp_ds2ddl.sas [code]
 Fetches DDL for a specific table.
 
file  mp_ds2fmtds.sas [code]
 Converts every value in a dataset to formatted value.
 
file  mp_ds2inserts.sas [code]
 Export a dataset to SQL insert statements.
 
file  mp_ds2md.sas [code]
 Create a Markdown Table from a dataset.
 
file  mp_ds2squeeze.sas [code]
 Create a smaller version of a dataset, without data loss.
 
file  mp_dsmeta.sas [code]
 Export dataset metadata to a single output table.
 
file  mp_filtercheck.sas [code]
 Checks an input filter table for validity.
 
file  mp_filtergenerate.sas [code]
 Generates a filter clause from an input table, to a fileref.
 
file  mp_filterstore.sas [code]
 Checks & Stores an input filter table and returns the Filter Key.
 
file  mp_filtervalidate.sas [code]
 Checks a generated filter query for validity.
 
file  mp_getcols.sas [code]
 Creates a dataset with column metadata.
 
file  mp_getconstraints.sas [code]
 Get constraint details at column level.
 
file  mp_getdbml.sas [code]
 Extract DBML from SAS Libraries.
 
file  mp_getddl.sas [code]
 Extract DDL in various formats, by table or library.
 
file  mp_getformats.sas [code]
 Export format definitions.
 
file  mp_getmaxvarlengths.sas [code]
 Scans a dataset to find the max length of the variable values.
 
file  mp_getpk.sas [code]
 Extract the primary key fields from a table or library.
 
file  mp_gitadd.sas [code]
 Stages files in a GIT repo.
 
file  mp_gitlog.sas [code]
 Creates a dataset with the commit history of a local repository.
 
file  mp_gitreleaseinfo.sas [code]
 Pulls latest release info from a GIT repository.
 
file  mp_gitstatus.sas [code]
 Creates a dataset with the output from GIT_STATUS()
 
file  mp_gsubfile.sas [code]
 Performs a text substitution on a file.
 
file  mp_guesspk.sas [code]
 Guess the primary key of a table.
 
file  mp_hashdataset.sas [code]
 Returns a unique hash for a dataset.
 
file  mp_hashdirectory.sas [code]
 Returns a unique hash for each file in a directory.
 
file  mp_include.sas [code]
 Performs a wrapped %include.
 
file  mp_init.sas [code]
 Initialise session with useful settings and variables.
 
file  mp_jsonout.sas [code]
 Writes JSON in SASjs format to a fileref.
 
file  mp_lib2cards.sas [code]
 Convert all library members to CARDS files.
 
file  mp_lib2inserts.sas [code]
 Convert all data in a library to SQL insert statements.
 
file  mp_loadformat.sas [code]
 Loads a format catalog from a staging dataset.
 
file  mp_lockanytable.sas [code]
 Mechanism for locking tables to prevent parallel modifications.
 
file  mp_lockfilecheck.sas [code]
 Aborts if a SAS lock file is in place, or if one cannot be applied.
 
file  mp_makedata.sas [code]
 Create sample data based on the structure of an empty table.
 
file  mp_md5.sas [code]
 Generates an md5 expression for hashing a set of variables.
 
file  mp_perflog.sas [code]
 Logs a message in a dataset every time it is invoked.
 
file  mp_prevobs.sas [code]
 Enables previous observations to be re-instated.
 
file  mp_recursivejoin.sas [code]
 Returns all children from a hierarchy table for a specified parent.
 
file  mp_replace.sas [code]
 Performs a text substitution on a file.
 
file  mp_reseterror.sas [code]
 Reset when an err condition occurs.
 
file  mp_resetoption.sas [code]
 Reset an option to original value.
 
file  mp_retainedkey.sas [code]
 Generate and apply retained key values to a staging table.
 
file  mp_runddl.sas [code]
 An opinionated way to execute DDL files in SAS.
 
file  mp_searchcols.sas [code]
 Searches all columns in a library.
 
file  mp_searchdata.sas [code]
 Searches all data in a library.
 
file  mp_setkeyvalue.sas [code]
 Logs a key value pair a control dataset.
 
file  mp_sortinplace.sas [code]
 Sorts a SAS dataset in place, preserving constraints.
 
file  mp_stackdiffs.sas [code]
 Prepares an audit table for stacking (re-applying) the changes.
 
file  mp_storediffs.sas [code]
 Converts deletes/changes/appends into a single audit table.
 
file  mp_stprequests.sas [code]
 Capture session start / finish times and request details.
 
file  mp_streamfile.sas [code]
 Streams a file to _webout according to content type.
 
file  mp_stripdiffs.sas [code]
 Generates a stage dataset to revert diffs tracked in an audit table.
 
file  mp_testjob.sas [code]
 Runs arbitrary code for a specified amount of time.
 
file  mp_testservice.sas [code]
 To be deprecated. Will execute a SASjs web service on SAS 9 or Viya.
 
file  mp_testwritespeedlibrary.sas [code]
 Tests the write speed of a new table in a SAS library.
 
file  mp_tree.sas [code]
 Recursively scans a directory tree to get all subfolders and content.
 
file  mp_unzip.sas [code]
 Unzips a zip file.
 
file  mp_updatevarlength.sas [code]
 Change the length of a variable.
 
file  mp_validatecol.sas [code]
 Used to validate variables in a dataset.
 
file  mp_wait4file.sas [code]
 Wait until a file arrives before continuing execution.
 
file  mp_webin.sas [code]
 Fix the _WEBIN variables provided to SAS web services.
 
file  mp_zip.sas [code]
 Creates a zip file.