Macro List

(files shown in alphabetical order)
Shortcut to macro purposes

List of all macros

Jul 31  2007 addautos.sas
Feb 13  2007 adddecodevars.sas
Jul 31  2007 after.sas
Jul 30  2007 age.sas
Apr  3 10:27 agedec.sas
Jul 31  2007 aligndp.sas
Feb 13  2007 allfmtvals.sas
Jul 30  2007 allocr.sas
Jul 30  2007 allocw.sas
Jul 31  2007 alluniq.sas
Mar 29  2007 asciinonp.sas
Dec 17  2007 attrc.sas
Dec 17  2007 attrn.sas
Dec 17  2007 attrv.sas
Mar 21  2007 autoexec.sas
Mar 29  2007 bydrop.sas
Feb 13  2007 bytitle.sas
Jul 30  2007 capmac.sas
Jul 30  2007 capvar.sas
Jul 30  2007 casestrmac.sas
Jul 30  2007 casestrvar.sas
Mar 29  2007 char2num.sas
Feb 13  2007 chkuniq.sas
Jul 30  2007 chompw.sas
Jul 31  2007 clashvars.sas
Mar 29  2007 clength.sas
Jul 31  2007 closerep.sas
Jul 30  2007 commas.sas
Jul 30  2007 complibs.sas
Jul 31  2007 compress.sas
Jul 31  2007 crdte.sas
Jul 30  2007 crprotds.sas
Jul 30  2007 crtitlesds.sas
Jul 30  2007 ctitlepgmrk.sas
Jul 31  2007 datanulldemo.sas
Mar 29  2007 delhex.sas
Mar 29  2007 delzero.sas
Jan 19 07:39 dequote.sas
Mar 29  2007 doallitem.sas
Feb 13  2007 dosemerge.sas
Jul 30  2007 dosfileinfo.sas
Jul 30  2007 dosfilesize.sas
Mar 29  2007 dropvars.sas
Feb 13  2007 dsall.sas
Mar 29  2007 dsattrib.sas
Jul 31  2007 dslabel.sas
Feb 13  2007 dslist.sas
Jul 31  2007 dtscale.sas
Jul 31  2007 duplvars.sas
Jul 30  2007 endwith.sas
Jul 30  2007 eqsuff.sas
Jul 31  2007 equals.sas
Aug 16  2007 fithdr.sas
Mar 29  2007 fixvars.sas
Feb 13  2007 flatten.sas
Feb 13  2007 fmtord.sas
Jul 30  2007 fmtpath.sas
Jul 31  2007 fmts2fda.sas
Jul 31  2007 fullmonty.sas
Jul 30  2007 getvalue.sas
Jul 31  2007 globexist.sas
Jul 31  2007 globlist.sas
Jul 30  2007 hasvars.sas
Jul 30  2007 hasvarsc.sas
Jul 30  2007 hasvarsn.sas
Mar 29  2007 hexchars.sas
Feb 13  2007 hexcnt.sas
Jul 30  2007 jobinfo.sas
Jul 30  2007 lafootnote.sas
Jul 30  2007 latitle.sas
Jul 30  2007 layout2lsps.sas
Jul  1  2007 lcralign.sas
Jul 31  2007 left.sas
Mar 29  2007 ljustify.sas
Feb 13  2007 locf.sas
Feb 13  2007 lookahead.sas
Jul 30  2007 lowcase.sas
Mar 29  2007 lrafootnote.sas
Mar 29  2007 lratitle.sas
Jul 31  2007 ltgtm1.sas
Jul 30  2007 match.sas
Jul 30  2007 maxtitle.sas
Feb 13  2007 misscnt.sas
Feb 13  2007 missvars.sas
Jul 30  2007 mkformat.sas
Jul 31  2007 modte.sas
Jun  6 22:54 mtype.sas
May 12 16:37 nlobs.sas
May 12 16:42 nobs.sas
Mar 19 15:53 nodata.sas
Jul 31  2007 nodup.sas
Feb 13  2007 nodupkey.sas
Jul 30  2007 noquotes.sas
Sep  7  2007 now.sas
Jul 30  2007 npctpvals.sas
Jun  2 08:35 npcttab.sas
Jul  1  2007 numchars.sas
Jul 30  2007 nvars.sas
Jul 30  2007 nvarsc.sas
Jul 30  2007 nvarsn.sas
Jul 30  2007 openrep.sas
Mar 29  2007 optlength.sas
Jul 30  2007 pagexofy.sas
Jul 11 00:31 partialdates.sas
May  2 15:12 popfmt.sas
Mar 29  2007 printall.sas
Jul 30  2007 proginfo.sas
Jul 30  2007 protinfo.sas
Jul 31  2007 putvars.sas
Jul 31  2007 qcompress.sas
Jul 31  2007 qleft.sas
Jul 31  2007 qtrim.sas
Jul 30  2007 quotecnt.sas
May 21 11:39 quotelst.sas
Jul 30  2007 quotescan.sas
Mar 29  2007 rafootnote.sas
Mar  7 22:06 rannomac.sas
Mar 29  2007 ratitle.sas
Jul 31  2007 readfile.sas
Jul 30  2007 readpipe.sas
Jul 30  2007 remove.sas
Jan 26 09:21 removew.sas
Mar 29  2007 replhex.sas
Mar 29  2007 round.sas
Jul 30  2007 rxmatch.sas
Apr 20 12:15 scanlog.sas
Feb 13  2007 showhex.sas
Jul 30  2007 sortedby.sas
Jul 30  2007 splitmac.sas
Sep  7  2007 splitvar.sas
Jul 30  2007 substrw.sas
Feb 13  2007 supasort.sas
Sep  7  2007 sysfmtlist.sas
Jul 31  2007 therest.sas
Jul 30  2007 titlegen.sas
Feb 13  2007 titlelen.sas
Jul 30  2007 titles.sas
Jul 30  2007 trim.sas
Sep 17  2007 unicat2word.sas
Jun  2 08:35 unicatrep.sas
Jan 27 08:57 unimap.sas
May 12 16:35 unipvals.sas
Jun  2 08:32 unistats.sas
Jul 30  2007 varfmt.sas
Jul 31  2007 varinfmt.sas
Jul 30  2007 varlabel.sas
Jul 30  2007 varlen.sas
Jul 30  2007 varlist.sas
Jul 30  2007 varlistc.sas
Jul 30  2007 varlistn.sas
Jul 30  2007 varnum.sas
Jul 30  2007 vartype.sas
Mar 29  2007 vaxis.sas
Jul 31  2007 verify.sas
Jul 30  2007 verifyb.sas
Jul 30  2007 windex.sas
Jul 30  2007 words.sas
Feb  3 02:55 xl2sas.sas
Jul 31  2007 xytitles.sas
Mar 29  2007 yrcutoff.sas
Feb 13  2007 zerogrid.sas

Macro purposes

 Index of members in this directory with standard headers
========================================================
(this list was generated by the crindex script)

addautos.sas       - To concatenate a macro library onto the sasautos path

                     Usage: %addautos(mymacros)
 

adddecodevars.sas  - To add decode variables where a user format is specified

                     Usage: %adddecodevars(dsin=ds1,dsout=ds2)
 

after.sas          - Function-style macro to give you what comes directly after a
                     target string.

                     Usage: %let width=%after(&str,%str(width=),%str( w=));
 

age.sas            - In-datastep function-style macro to calculate the age of a person
                     on a date.

                     Usage: data test;
                     age=%age(dob,date);

agedec.sas         - In-datastep function-style macro to calculate the age of a person
                     on a date as a decimal age.

                     Usage: data test;
                     agedec=%agedec(dob,date);

aligndp.sas        - In-datastep macro to create a string from a numeric value with
                     decimal points aligned.

                     Usage: %aligndp(numvar,charvar,4);
 

allfmtvals.sas     - Create a dataset with every start value of a format in

                     Usage: %allfmtvals(fmt=$country,var=country,dsout=temp1,length=2)
                     %allfmtvals(fmt=site,var=site,dsout=temp2)

allocr.sas         - Spectre (Clinical) example macro to allocate data libraries and
                     formats in read mode.

                     Usage: %allocr
 

allocw.sas         - Spectre (Clinical) example macro to allocate data libraries and
                     formats in write mode.

                     Usage: %allocw
 

alluniq.sas        - To create a dataset with all unique occurences of a variable
                     throughout a library.

                     Usage: %alluniq(in,subject,allsubj)
 

asciinonp.sas      - To show up ascii non-printables characters in a flat file by
                     displaying their hex codes.

                     Usage: %asciinonp(infile,outfile)
 

attrc.sas          - Function-style macro to return a character attribute of a dataset

                     Usage: %let dslabel=%attrc(dsname,label);
                     %let sortseq=%attrc(dsname,sortedby);
 

attrn.sas          - Function-style macro to return a numeric attribute of a dataset

                     Usage: %let nobs=%attrn(dsname,nlobs);
 

attrv.sas          - Function-style macro to return a variable attribute

                     Usage: %let vartype=%attrv(dsname,varname,vartype);
 

bydrop.sas         - To drop by-group residuals

                     Usage: %bydrop(dsin,by1 by2)
         

bytitle.sas        - To drop the last title if it is a "by" title and write it to the
                     global macro variable _bytitle_ instead.

                     Usage: %bytitle
 

capmac.sas         - Function-style macro to capitalise the first letter of each
                     word in a macro string.

                     Usage: %let tidy=%capmac(%bquote(A, B AND C'S RESULTS));
 

capvar.sas         - In-datastep macro to tidy case of text in a variable

                     Usage: data lparmcd;
                     set lparmcd;
                     %capvar(put(lparmcd,lparmcd.),newvar,
                     ignore="SGOT" "SGPT" "PTT" "LDH" "GGT" "BUN");
                     run;

casestrmac.sas     - Function-style macro to force mixed case forms of a string into
                     the string itself for a macro expression.

                     Usage: %let newtext=%casestrvar(&oldtext,Roland);

casestrvar.sas     - In-datastep macro to force mixed case forms of a string into the
                     string itself.

                     Usage: data test2;
                     set test;
                     %casestrvar(text,'Roland');
                     run;

char2num.sas       - To "effectively" convert a list of character variables to numeric

                     Usage: %char2num(test,test2,char1 char2 char3 char4)
 

chkuniq.sas        - To check for uniqueness in key variables.

                     Usage: %chkuniq(dsname)
 

chompw.sas         - Function-style macro to cut out a word from a macro string and
                     optionally cut out words before and/or after it.

                     Usage: %let str2=%chompw(&str1,&target,2,0,casesens=yes);
 

clashvars.sas      - To identify where there is a clash of variable characteristics and
                     output diagnostics.

                     Usage: %clashvars(mylib)
 

clength.sas        - To create a length statement to unify character lengths in a list
                     of data sets to the maximum variable length.

                     Usage: %clength(ds1 ds2 ds3);
                     data all;
                     &_clength_;
                     set ds1 ds2 ds3;
                     run;

closerep.sas       - Spectre (Clinical) macro to close the temporary file created
                     by the %openrep macro for redirected sas output and copy to a
                     final output file with page number labels added.

                     Usage: Should be used with the %titles and %openrep macros as below.
 
                     %allocr
                     %titles
                     %openrep
                     <reporting code>
                     %closerep
 

commas.sas         - Function-style macro to separate the elements of a list with
                     commas.

                     Usage: order by %commas(&var1 &var2 &var3);
 

complibs.sas       - To "proc compare" identically-named datasets in two libraries

                     Usage: %complibs(base,comp)
 

compress.sas       - Function-style macro to compress a macro string

                     Usage: %let str2=%compress(&str,1234567890.);
 

crdte.sas          - Function-style macro to return the creation datetime stamp of a
                     dataset.

                     Usage: %let crdte=%crdte(dsname);
 

crprotds.sas       - Spectre (Clinical) macro to create a protocol dataset from a
                     protocol details flat file.

                     Usage: %crprotds(flatfile,der.study)
 

crtitlesds.sas     - Spectre (Clinical) macro to create a titles dataset from a
                     titles flat file.

                     Usage: %crtitlesds(flatfile,der.titles)
 

ctitlepgmrk.sas    - Create a centered top title with a right-most "ff"x page mark

                     Usage: %ctitlepgmrk("centred title")
 

datanulldemo.sas   - To do a stacked-column report using data _null_ that does not
                     To do a stacked-column report using data _null_ that does not
                     leave line gaps like proc report does.
                     leave line gaps like proc report does.

                     Usage: Ordinary SAS code.
                     Ordinary SAS code.
 
 

delhex.sas         - To delete occurrences of a specified hex character in a flat file.

                     Usage: %delhex(infile,outfile,'FE'x)
 

delzero.sas        - To delete all datasets in a library with zero observations. This
                     macro was written for illustration purposes and is of limited use.

                     Usage: %delzero(work)
 

dequote.sas        - Function-style macro to remove front and end matching quotes
                     from a macro string.

                     Usage: %let str=%dequote(%readpipe(echo '%username%'));
                     CLASS %unquote(%dequote('&trtvar')) ;

doallitem.sas      - To execute code for each item in a space-delimited list

                     Usage: %doallitem(dsa dsb dsc,'proc sort data=&item;by var;run;')
 

dosemerge.sas      - To merge dose in with date

                     Usage: 
 

dosfileinfo.sas    - Function-style macro to return information about a DOS file

                     Usage: %let filesize=%dosfileinfo(C:\spectre\unistats.html,z);

dosfilesize.sas    - Function-style macro to return a DOS file size

                     Usage: %let filesize=%dosfilesize(C:\spectre\unistats.html);

dropvars.sas       - To drop a list of unwanted variables in a list of datasets.

                     Usage: %dropvars(work._all,x1 x2)
 

dsall.sas          - To expand out the _all_ in a dataset list into all datasets in the
                     library.

                     Usage: %dsall(sasuser.test work._all_);
                     %let dsall=&_dsall_;

dsattrib.sas       - To force a set of attributes, held in a template dataset,
                     on another dataset.

                     Usage: %dsattrib(template,inds,outds)
 

dslabel.sas        - Function-style macro to return a dataset label

                     Usage: %let dslabel=%dslabel(dsname);
 

dslist.sas         - To list all the datasets in a libref.

                     Usage: %dslist(work);
                     %let dslist=&_dslist_;

dtscale.sas        - To generate a date scale for sas/graph

                     Usage: %dtscale(&min,&max);
 

duplvars.sas       - Function-style macro to create a list of duplicate variables in a
                     second dataset so that they can be dropped before a merge.

                     Usage: data newds;
                     merge ds1 ds2(drop=%duplvars(ds1,ds2,&bylist));
                     by &bylist;
                     run;

endwith.sas        - Function-style macro to ensure any non-null value assigned to a
                     macro variable ends with the specified character.

                     Usage: filename outfile "%endwith(&outdir,/)output.txt";
 

eqsuff.sas         - Function-style macro to suffix a list of words (usually variables)
                     with an equals sign.

                     Usage: put %eqsuff(&varlist);
 

equals.sas         - In-datastep function-style macro to compare two numeric values to
                     find if they are equal or very nearly equal.

                     Usage: if %equals(val1,7.3) then ...
 

fit(progname.sas)  - To "fix" variables in a library so they are consistent

                     Usage: fixvars(mylib,w);
 

flatten.sas        - To "flatten" data so there is only one observation per "by group"

                     Usage: %flatten(dsin=test,bygroup=by1 by2,vars=str num)
 

fmtord.sas         - To create a numeric informat that maps a format label to its
                     order position.

                     Usage: %fmtord(agernge);
 

fmtpath.sas        - Function-style macro to get the full fmtsearch path

                     Usage: %let path=%fmtpath;
 

fmts2fda.sas       - To create sas code to generate formats as found in your data

                     Usage: %fmts2fda(mylib1 mylib2)
 

getvalue.sas       - Function-style macro to return a variable's value

                     Usage: %let value=%getvalue(dsname,varname,1);
 

globexist.sas      - Function-style macro to return true if all the global macro
                     variables listed exist.

                     Usage: %if %globexist(globvar) %then %do ....
 

globlist.sas       - Function-style macro to return a list of current global macro
                     variable names.

                     Usage: %let glist=%globlist;
 

hasvars.sas        - Function-style macro to return true if a dataset has all the
                     variables defined to a list.

                     Usage: %if not %hasvars(dsname,aa bb cc) %then %do ....
 

hasvarsc.sas       - Function-style to return true if a dataset has all the character
                     variables defined to a list.

                     Usage: %if not %hasvarsc(dsname,aa bb cc) %then %do ....
 

hasvarsn.sas       - Function-style macro to return true if a dataset has all the
                     numeric variables defined to a list.

                     Usage: %if not %hasvarsn(dsname,aa bb cc) %then %do ....
 

hexchars.sas       - To show up ascii non-printables characters in a flat file by
                     displaying their hex codes.

                     Usage: %hexchars(infile,outfile)
 

hexcnt.sas         - To count the strange hex character in character variables

                     Usage: %hexcnt(dsname,droplist,globcnt=_hexcnt_,globvars=_hexvars_);

jobinfo.sas        - To store important job information in global macro variables

                     Usage: %jobinfo
 

lafootnote.sas     - To create a left-aligned footnote

                     Usage: %lafootnote(2,"  second footnote indented two spaces")
 

latitle.sas        - To create a left-aligned title

                     Usage: %latitle(2,"  second title indented two spaces")
 

layout2lsps.sas    - Spectre (Clinical) macro to calculate sas linesize and pagesize
                     values based on paper type, margins and layout.

                     Usage: %layout2lsps(lmargin=1.0,rmargin=0.75,tmargin=1.0,bmargin=1.0,
                     paper=A4,layout=L10);

lcralign.sas       - Write to a macro variable with the supplied text left, center
                     and right-aligned.

                     Usage: %let macvar=;
                     %lcralign(macvar,50,"left bit","center bit","right bit")
                     %put macvar=*&macvar*;

left.sas           - Function-style macro to left-align the contents of a macro
                     variable.

                     Usage: %let macvar=%left(&macvar);
 

ljustify.sas       - To left-justify all character fields in a dataset

                     Usage: ljustify(dset)
 

locf.sas           - To perform "Last Observation Carried Forward" processing.

                     Usage: 
 

lookahead.sas      - To do the opposite of lag and allow the user to look ahead at the
                     variables in the following observations in the same by group.

                     Usage: 
 

lowcase.sas        - Function-style macro to return a lower-case version of a macro
                     variable's contents.

                     Usage: %let lcase=%lowcase(&string);
 

lrafootnote.sas    - To left and right-align a two part footnote for a pure text output

                     Usage: %lrafootnote(5,"Left aligned","Right-aligned")
 

lratitle.sas       - To left and right-align a two part title for a pure text output

                     Usage: %lratitle(5,"Left aligned","Right-aligned")
 

ltgtm1.sas         - In-datastep macro to turn a text numeric value into a numeric
                     value and handle "<" and ">" signs preceding and adjust the value
                     according to a rule.

                     Usage: %ltgtm1(textvar,numvar);
 

match.sas          - Function-style macro to return elements of a list that match those
                     in a reference list.

                     Usage: %let match=%match(aa bb,aa cc);
 

maxtitle.sas       - To find the highest number title and footnote and output to global
                     macro variables.

                     Usage: %maxtitles
 

misscnt.sas        - To create a list of variables and their missing value count

                     Usage: %misscnt(dsname,droplist,globvar=_miss_);

missvars.sas       - To create a list of all-missing variables

                     Usage: %missvars(dsname,globvar=_miss_);
                     run;
                     data dsname;
                     set dsname(drop=&_miss_);
                     run;

mkformat.sas       - To create a format out of a "coded" and "decoded" variable

                     Usage: %mkformat(dsname,varcode,vardcode,fmtname,fmtcat);
 

modte.sas          - Function-style macro to return the last modification datetime
                     stamp of a dataset.

                     Usage: %let modte=%modte(dsname);
 

mtype.sas          - Function-style macro to return the member type of a dataset
                     (i.e. whether DATA or VIEW).

                     Usage: %let mtype=%mtype(dsname);
 

nlobs.sas          - Function-style macro to return the number of logical observations
                     (i.e. not marked for deletion) in a dataset or view. This will
                     either be a positive integer or forced to zero.

                     Usage: %put >>>>>> %nlobs(sashelp.class) >>>>;
                     %put >>>>>> %nlobs(sashelp.class(where=(sex="M"))) >>>>;
                     %put >>>>>> %nlobs(sashelp.vtable) >>>>;

nobs.sas           - Function-style macro to return the number of observations in a
                     dataset or view. This will either be a positive integer or forced
                     to zero.

                     Usage: %put >>>>>> %nobs(sashelp.class) >>>>;
                     %put >>>>>> %nobs(sashelp.class(where=(sex="M"))) >>>>;
                     %put >>>>>> %nobs(sashelp.vtable) >>>>;

nodata.sas         - To produce a "No Data" report

                     Usage: %if not %nobs(dset) %then %do;
                     %nodata
                     %goto skip;
                     %end;

nodup.sas          - Function-style macro to drop duplicates in a space-delimited list

                     Usage: %let str=%nodup(aaa bbb aaa);
 

nodupkey.sas       - To sort "nodupkey" but list observations being dropped so that
                     they can be investigated and accounted for.

                     Usage: %nodupkey(ds,var1 var2 var3)
                

noquotes.sas       - Function-style macro to remove all quoted strings from a macro
                     expression.

                     Usage: %let noquotes=%noquotes(&str);
 

now.sas            - Function-style macro to return the current timestamp

                     Usage: %put Stage1: %now;
 

npctpvals.sas      - Clinical reporting macro that calculates p-values for the
                     %npcttab macro.

                     Usage: %npctpvals(dsin=data1,byvars=byvar1 byvar2,trtvar=trtgrp,
                     respvar=resp,countvar=count,pvalstr=TRT9999)
 

npcttab.sas        - Clinical reporting macro to produce tables showing "n", the
                     percentage and optionally the number of events.

                     Usage: See tutorial with demonstrations on this web site
 

numchars.sas       - To create a list of character variables that contain numeric-like
                     text.

                     Usage: %numchars(dsname,globvar=_numchars_);
                     %put ######## &_numchars_;

nvars.sas          - Function-style macro to return the number of variables in a
                     dataset.

                     Usage: %let nvars=%nvars(dsname);
                   

nvarsc.sas         - Function-style macro to return the number of character variables
                     in a dataset.

                     Usage: %let nvarsc=%nvarsc(dsname);
 

nvarsn.sas         - Function-style macro to return the number of numeric variables in
                     a dataset.

                     Usage: %let nvarsn=%nvarsn(dsname);
 

openrep.sas        - Spectre (Clinical) macro to redirect print output to a
                     temporary file.

                     Usage: Should be used with the %titles and %closerep macros as below.
 
                     %allocr
                     %titles
                     %openrep
                     <reporting code>
                     %closerep
 

optlength.sas      - To create a length statement for character variables that take up
                     less length than that allotted to the variable.

                     Usage: optlength(dset)
                     data dset;
                     &_optlength_;
                     set dset;
                     run;
       

pagexofy.sas       - To add "Page x of Y" labels where the 'FF'x character is found
                     and to make other special character substitutions.

                     Usage: %pagexofy(myfile.lst)
                     %pagexofy(myfile.lst,style="Page x of Y")
                     %pagexofy(myfile.lst,style="Seite x von Y")
                     %pagexofy(myfile.lst,style="(PAGE X OF Y)")
                     %pagexofy(myfile.lst,style="SEITE x")
                     %pagexofy(myfile.lst,style="[SEITE x]"

partialdates.sas   - In-datastep macro to impute partial dates to a high or low value

                     Usage: data test;
                     datestr="--feb08";
                     %partialdates(datetext=datestr,datevar=date,pattern="ddmmmyy",
                     lohi=high);
                     format date date9.;
                     put date= datestr=;
                     run;
                     29FEB2008

popfmt.sas         - Clinical reporting macro to create a treatment format that is the
                     same as an existing format but with the (N=xxx) at the end.

                     Usage: %popfmt(stat.acct(where=(xxx=1 and &_pop_.cd=1)),trtgroup)
 

printall.sas       - To print every observation in a library where a variable satisfies
                     a specified condition.

                     Usage: %printall(work,%str(num>1))
 

proginfo.sas       - Spectre (Clinical) macro to store important program information
                     in global macro variables.

                     Usage: %proginfo
 

protinfo.sas       - Spectre (Clinical) macro to store important protocol information
                     in global macro variables.

                     Usage: %protinfo
 

putvars.sas        - To list variables in a dataset suffixed with an equals sign
                     suitable for a "put" statement written to the log.

                     Usage: put %putvars(ds);
 

qcompress.sas      - Function-style macro to compress a macro variable string and
                     return the result quoted.

                     Usage: %let tidy=%qcompress(&string);
 

qleft.sas          - Function-style macro to left-align the contents of a macro
                     variable and return the result quoted.

                     Usage: %let macvar=%qleft(&macvar);
 

qtrim.sas          - Function-style macro to trim the contents of a macro variable and
                     return the results macro-quoted.

                     Usage: %let macvar=%qtrim(&macvar);
 

quotecnt.sas       - Function-style macro to count quoted strings in a macro expression

                     Usage: %let count=%quotecnt(&str);
 

quotelst.sas       - Function-style macro to quote the elements of a list

                     Usage: %if %index(%quotelst(varnames),"varname") %then...
 

quotescan.sas      - Function-style macro to scan for a quoted string in a macro
                     expression.

                     Usage: %let scan=%quotescan(&str,2);
 

rafootnote.sas     - To right-align a footnote for a pure text output

                     Usage: %rafootnote(5,"This footnote 5 will be right-aligned")
 

rannomac.sas       - Compile Roland's annotate macros

                     Usage: filename webout "C:\spectre\";
 
                     goptions reset=all xpixels=1000 ypixels=6000 hpos=50 vpos=300
                     dev=gif gsfmode=replace transparency border
                     ftext='Arial' htext=1 cell ctext=CX483D8C; * DarkSlateBlue ;
 
                     ods listing close;
                     ods html path=webout body="annotest.html";
                     
                     %rannomac
 
                     data test;
                     %dclannovars
                     %rarrow(y=298,x1=20,x2=48)
                     %text(y=298,x=19,position='<',text="right-aligned text")
                     %rarrow(y=297,x1=20,x2=48,fillcolor='green',
                     linecolor='black',fillpattern='mempty')
                     %text(y=297,x=19,position='<',text="next line of text")
                     %text(y=296,x=19,position='<',
                     text="This has a hotspot but misaligned on the left",
                     color='maroon',
                     html="alt='This hotspot is misaligned on the left of the text'")
                     %box(y=295,x=25)
                     %box(y=295,x=35)
                     %box(y=295,x=45,html="alt='Third Box Hotspot'")
                     %text(y=295,x=19,position='<',
                     text="The third box ONLY should have a hotspot")
                     %bigbox(x1=20,y1=294.5,x2=50,y2=298.5,linecolor="brown")
                     run;
 
                     *- Set description to a space to stop whole output area -;
                     *- from having a hotspot and give the gif the same name -;
                     *- as the html body file. -;
                     proc ganno annotate=test description=" " name="annotest";
                     run;
 
                     *- If you rerun this code then you need to delete the -;
                     *- "annotest" grseg member in work.gseg so it can be  -;
                     *- reused as a name in the "proc ganno" step.  -;
                     proc greplay igout=gseg nofs;
                     delete annotest;
                     run;
                     quit;
 
                     ods html close;
                     ods listing;
 

ratitle.sas        - To right-align a title for a pure text output

                     Usage: %ratitle(5,"This title 5 will be right-aligned")
 

readfile.sas       - Function-style macro to read in a flat file and assign the
                     contents to a macro variable.

                     Usage: %let mvar=%readfile(filename);
 

readpipe.sas       - Function-style macro to read the output of a system command and
                     assign it to a macro variable.

                     Usage: %let mvar=%readpipe(echo $USER);
                 

remove.sas         - Function-style macro to remove all occurrences of the target
                     string(s) from another string.

                     Usage: %let string2=%remove(&string1,XXX,yyy,YYY);
 

removew.sas        - Function-style macro to remove all occurrences of the target
                     word(s) from a source list of words.

                     Usage: %let colors2=%remove(&rainbow,green yellow);
 

replhex.sas        - To replace occurrences of a specified hex character in a flat file
                     with another specified character.

                     Usage: %replhex(infile,outfile,'FE'x,' ')
 

round.sas          - To round all the numeric variables in a list of datasets.

                     Usage: %round(work._all_)
 

rxmatch.sas        - Function-style macro to return those space-delimited elements of a
                     list that match a specified rxparse pattern.

                     Usage: %let match=%rxmatch(apopa pop aapop popaa,pop $s);
                     %put &match;
                     pop aapop

scanlog.sas        - To scan a sas log file for important messages

                     Usage: %scanlog("full-file-path-name")
                     or
                     %scanlog(fileref)

showhex.sas        - To create a new dataset where hex characters in character
                     variables are highlighted.

                     Usage: %showhex(test1,test2,cvar1 cvar2 cvar3)
 

sortedby.sas       - Function-style macro to return the variables a dataset is sorted
                     by, or null if not sorted.

                     Usage: %let sortedby=%sortedby(dsname);
 

splitmac.sas       - Function-style macro to insert split characters in a macro string

                     Usage: %let str=The quick brown fox jumped over the lazy dog;
                     %let splitstr=%splitmac(&str,10);

splitvar.sas       - In-datastep macro to insert split characters in a string variable

                     Usage: data aaa;
                     set aaa;
                     %split(var,10,split='/');
                     run;

substrw.sas        - Function-style macro to substring words assigned to a macro
                     variable.

                     Usage: %let whatsleft=%substrw(&mvar,4);
                     %let twothree=%substrw(&str,2,2);

supasort.sas       - To sort a list of datasets by variables if they exist in the
                     datasets.

                     Usage: %supasort(work._all_,date time)
                     

sysfmtlist.sas     - In-datastep macro to list all the system formats

                     Usage: if format in (" " %sysfmtlist) then _fmt="SYS";
                     else _fmt="USR";

therest.sas        - Function-style macro to give you everything following any found
                     target string character.

                     Usage: %let rest=%therest(&str,\/);
 

titlegen.sas       - To generate titles and footnotes from a dataset of the style
                     created by the %crtitlesds macro.

                     Usage: %titlegen(dsname)
 

titlelen.sas       - To create a copy of sashelp.vtitle but with the length added.

                     Usage: %titlelen
 

titles.sas         - Spectre (Clinical) macro to create the titles and footnotes for
                     a standard report.

                     Usage: Should be used with the %openrep and %closerep macros as below.
 
                     %allocr
                     %titles
                     %openrep
                     <reporting code>
                     %closerep
 

trim.sas           - Function-style macro to trim the contents of a macro variable

                     Usage: %let macvar=%trim(&macvar);
 

unicat2word.sas    - Clinical reporting macro to produce a Word-style cell table
                     from the dataset output from the %unistats macro of treatment-
                     transposed categories counts and statistics.

                     Usage: %unicat2word(dsin=_unitran,dest=print,dlim=';')
 

unicatrep.sas      - Clinical reporting macro to produce a report from the dataset
                     output from the %unistats macro of treatment-transposed
                     categories counts and statistics.

                     Usage: %unicatrep(dsin=_unitran)
 

unimap.sas         - Clinical reporting macro to map proc univariate labels to the
                     actual stats keyword names.

                     Usage: %let stats=%unimap(&labels);

unipvals.sas       - Clinical reporting macro to calculate p-values for the
                     %unistats macro.

                     Usage: %unipvals(dsin=means,dsout=out,trtvar=tmt,respvar=val,type=N)
 

unistats.sas       - Clinical reporting macro to calculate proc univariate
                     statistics and category counts with percentages with optional
                     pvalues and optionally print a report.

                     Usage: %unistats(dsin=means,dsout=out,dspout=pout,trtvar=tmt,
                     varlist=val,stats=n mean min max std,pvarlist=val);
 

varfmt.sas         - Function-style macro to return a variable format

                     Usage: %let varfmt=%varfmt(dsname,varname);
 

varinfmt.sas       - Function-style macro to return a variable informat

                     Usage: %let varinfmt=%varinfmt(dsname,varname);
 

varlabel.sas       - Function-style macro to return a variable label

                     Usage: %let varlabel=%varlabel(dsname,varname);
 

varlen.sas         - Function-style macro to return a variable length

                     Usage: %let varlen=%varlen(dsname,varname);
 

varlist.sas        - Function-style macro to return a list of variables in a dataset

                     Usage: %let varlist=%varlist(dsname);
 

varlistc.sas       - Function-style macro to return a list of character variables in a
                     dataset.

                     Usage: %let varlistc=%varlistc(dsname);
 

varlistn.sas       - Function-style macro to return a list of numeric variables in a
                     dataset.

                     Usage: %let varlistn=%varlistn(dsname);
         

varnum.sas         - Function-style macro to return the variable position in a dataset
                     or 0 if not in dataset.

                     Usage: %let varnum=%varnum(dsname,varname);
 

vartype.sas        - Function-style macro to return a variable type as either C or N

                     Usage: %let vartype=%vartype(dsname,varname);
 

vaxis.sas          - To generate the values to construct a vaxis scale

                     Usage: %vaxis(&min,&max,spare=1)
 

verify.sas         - Function-style macro to return the position of the first character
                     in a string that does not match any character in a reference
                     string.

                     Usage: %let pos=%verify(&text,%str( )); %*- first non-blank character -;
 

verifyb.sas        - Function-style macro to return the position of the first character
                     in a string that does not match any character in a reference
                     string BUT STARTING FROM THE BACK.

                     Usage: %let pos=%verifyb(&text,%str( )); %*- last non-blank character -;
 

windex.sas         - Function-style macro to return the word count position in a string

                     Usage: %let windex=%windex(string,target);
             

words.sas          - Function-style macro to return the number of words in a string

                     Usage: %let words=%words(string);

xl2sas.sas         - Read an html Excel spreadsheet into a sas dataset using DDE

                     Usage: %xl2sas(xlfile=C:\myfiles\myspred.xls,sheetname=Results,
                     dsout=sasuser.myspred,compress=no,vpref=_col,vlen=50,
                     startrow=5,startcol=1,endrow=95,endcol=10)

xytitles.sas       - Spectre (Clinical) macro to finish creating the header lines
                     for the imaginary XenuYama pharmaceutical company style.

                     Usage: Must be called from within the %titles macro and must not be
                     used standalone.

yrcutoff.sas       - To set the year cutoff option to a number of years previous to the
                     current year. 90 is the default which is suitable for Clinical
                     Reporting.

                     Usage: %yrcutoff
 

zerogrid.sas       - To create a "grid" of combined values with a variable set to zero
                     for all combinations of values.

                     Usage: %zerogrid(dsout=grid,var1=subject,ds1=demog,var2=tmtarm,
                     ds2=demog,zerovar=count,sortby=tmtarm subject)
                     %zerogrid(zerovar=str,zero="  0 (  0.0)",var1=trtrand ddose,
                     ds1=period1,var2=day,ds2=period1)
 


 

Use the "Back" button of your browser to return to the previous page