No description, website, or topics provided.
SAS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
toDoc
.gitattributes
.gitignore
ARRAY.sas
DO_OVER.SAS
DirExist.sas
For.sas
MLSORT2.sas
MLSORT3.sas
NUMLIST.SAS
PermutationOf.sas
README.md
_ListProcessing
_ListProcessing_Combine.bat
add_string.sas
appmvar.sas
capmac.sas
changesep.sas
countw.sas
dequote.sas
dir.sas
dirfpq.sas
editlist.sas
getVar.sas
get_label.sas
get_type.sas
match.sas
missvars.sas
nodup.sas
noquotes.sas
num_tokens.sas
order.sas
parallel_join.sas
prefix.sas
qdequote.sas
qreadpipe.sas
qt.sas
quotecnt.sas
quotelst.sas
quotescan.sas
range.sas
range_non_int.sas
remove.sas
removew.sas
rename_string.sas
replace.sas
reverse.sas
seplist.sas
slice.sas
sorted.sas
splitmac.sas
suffix.sas
suffix_counter.sas
uqt.sas
windex.sas
words.sas
xprod.sas
zip.sas

README.md

SAS List Processing Utility Macros

Authors: see individual macros
Collector: Jiangtang Hu (www.Jiangtanghu.com)
Archived: https://github.com/Jiangtang/SAS_ListProcessing/

#To avoid any dependencies, submit the following codes to use it:

filename list url "https://raw.github.com/Jiangtang/SAS_ListProcessing/master/_ListProcessing";
%inc list;

List Creating

  • %range: produces a sequence like 1 2 3 or f1 f2 f3 or 1a 2a 3a

  • %range_non_int: increment a macro do loop by a non-integer value

  • %suffix_counter: Create a list of variable names formed by adding a numeric counter suffix to a base name.

  • %getVar: get all variables (N, C or all) from a dataset

  • %qreadpipe: read the output of a system command

  • %dir: return a list of members of a directory

  • %dirfpq: return a list of full-path quoted of members of a directory

List Formating

  • %changesep: change the separator for a list

  • %seplist: Emit a list of items separated by some delimiter

  • %splitmac: insert split characters in a macro string

  • %capmac: capitalise the first letter of each word in a macro string

Quoting

  • %qt: add quotes to each element in a list

  • %quotelst: quote the elements of a list

  • %upt: remove quotes from each element of a list

  • %qdequote: remove front and end matching quotes from a macro string

  • %dequote: remove front and end matching quotes from a macro string

  • %noquotes: remove all quoted strings from a macro expression

  • %quotecnt: count quoted strings in a macro expression

  • %quotescan: scan for a quoted string in a macro expression

List Properties

  • %num_tokens: Count the number of “tokens” (variables) in a list.
  • %countW: Retrieve the number of words in a macro variable
  • %words: return the number of words in a string
  • %windex: return the word count position in a string

##List Manipulation

  • %slice: return a sub-list sliced by a index

  • %zip: zips two lists together by joining correponding elements, see, a b and c d ==> ac bd

  • %parallel_join: Join two variable lists by connecting each variable in the first list to its correspondingvariable in the second list

  • %add_string: Add a text string to each variable in a list as either a prefix or suffix

  • %xprod: take cross product of two lists, see, a b and c d ==> ac ad bc bd

  • %appmvar: append a string onto an existing macro variable

  • %prefix: return a list with a prefix added

  • %suffix: return a list with a suffix added

  • %replace: replace symbolic variable in block of code with each element of a list, see, a b and code = #=__# ==> a=__a b=__b

  • %rename_string: Create a list suitable for the rename statement

  • %editlist: edit a list of space delimited items

  • %nodup: drop duplicates in a space-delimited list

  • %match: return elements of a list that match those in a reference list

  • %remove: remove all occurrences of the target string(s) from another string

  • %removew: remove all occurrences of the target word(s) from a source list of words.

  • %reverse: Reverse a macro variable's value (use %sysfunc(reverse) since v6.12)

  • %MLSORT2: sort a macro list

  • %MLSORT3: sort a macro list

  • %sorted: sort

  • %order: sort

  • %for: for each operation