As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.
Here are some tips for How to share your SAS knowledge with your professional network.
Summary / Purpose
This program computes summaries for one or more groups and test statistics for differences between two or more independent samples. It can output well-formatted tables into RTF or PDF files. It is a major modification of the %summary macro written by Ryan Lennon (2009 Mayo Clinic College of Medicine).
Rocio Lopez, Composer/Author
Sample Macro Call (Defaults listed)
%summtable(data=, class=, con1=, con2=, con3=, cat1=, cat2=, ord1=, subset=, colpct=1, pvalues=1, cutexact=50, totalcol=1, ncol=0, misscol=0, adhoc=0, oddsratios=0, unitscon1=, unitscon2=, unitscon3=, sortby=, list=, out=_out_, rtfout=_rtf_, rtffile=, xmlfile=, pdffile=, odsmemo=0, desclabel=0, printptype=1, sdopt=1, tbltitle=, bdytitle=0, style=journal, page=portrait, printfn=1, addfn=, daytime=0, f1=__Countf., f2=__Estf., f3=__Pctf., f4=__Estf., pfmt=Pvaluef., lablen=$40, perfmt=5.1, cwidth1=85, cwidth2=, cwidth3=, printp=0, prints=2);
- Dataset name
- At least one of the following--
- Continuous variable list; report mean ± sd with ANOVA
- Continuous variable list; report median (min, max) with Kruskal-Wallis test
- Continuous variable list; report median [P25, P75] with Kruskal-Wallis test
- Binary variable list; report N(%) for level=1 only with Pearson's chi-square/Fisher's Exact Test
- Nominal variable list; report N(%) for all levels with Pearson's chi-square/Fisher's Exact Test
- Ordinal variable list; report N(%) with Kruskal-Wallis test
- Specify how to sort variables in the table
- List for sorting variables if sortby = _list (no need to specify all)
- Name for SAS db
- Name for SAS db
- Name for RTF file with final table (must be surrounded by " ")
- Name for PDF file with final table
- Use a descriptive variable labels for table (i.e. Age, mean ± SD vs. Age)
- Attach superscript to denote type of test used (if =0 then footnote included)
- Use ± for con1 vars (if 2, then Mean (SD) used)
- Title for table
- Main SAS title/footnotes appear in body of RTF (1) or haders/footer (0)
- Style of ods tables
- Portrait vs. landscape page
- Print default footnotes (depends on choices made)
- Add your own footnote (no quotes)
- Add a day/time stamp to files
- Format for counts (N, N missing)
- Format for means, sd, %tiles, min, max
- Format for %'s
- Format for ORs and CIs
- Format for pvalues
- Length of variable labels
- Format for pvalues if prints=1 (print out db to output window)
- Width for N , N missing, p-value columns in RTF file
- Width for summary stats columns in RTF file
- Width for variable label column in RTF file
- Print resutls of FREQ, MEANS, NPAR1WAY while running
- Print _out_ (1) or _rtf_ (2) data sets
- It is a good idea to have all variables formatted, especially the CLASS variable
- CAT2 may contain SAS numeric or character variables, all other variable lists should contain SAS numeric variables.
- A variable should occur in only ONE display parameter list, i.e. don't put 'age' in both CON1 and CON2. You must create an identical variable with a different name to show different statistics.
- Variables which have all missing values will not be analyzed. Notification of this occurrence is sent to the SAS log.
- If NTOTALCOL=0, variable labels are flagged if there are missing values and a footnote is added stating # for each var.
- Default is to perform Exact tests for categorical variables if more than 50% of class have counts less than 5 but this can be manipulated with the CUTEXACT option. To supress exact tests then set CUTEXACT to a value greater than 100. A value of 0 would produce Exact tests only.
- If no class variable specified, TotalCol is ignored. If you want to print the N or N miss columns use NCOL=2 or MISSCOL=2 otherwise it will be ignored.
- The +/- sign from sdopt=1 will not print to output window with prints=2
- If ODSMEMO options is 1 then any option that controls the ods destination (style bodytitle etc.) will have no impact. Also, printp, rtffile, xmlfile and pdffile will be ignored.