Return to Stat Tools Home

Title: Summarize Continuous and Categorical Variables

Evaluate this tool by clicking on the stars:

%VOTE{id="EvalStatTools" stars1="Tools Overall Rating" stars2="Code Works Well" stars3="Good Instructions" global="off" open="off" secret="off" format="| $key | $small
Score: $score, My vote: $mylast, Total votes: $sum |" }%

Add Comments and then click on "Add comment" button

Please note any errors found in the macros.

%COMMENT%

StatToolsForm edit

Type of Tool SAS Macro
Title Table 1 -- Summarize Continuous and Categorical Variables
Programmer/Email BarbaraGrimes
Contributing Site UCSF
Description The Table1 macro summarizes continuous and categorical variables by subgroups.
Classification Graph Type
References
Datasets
Data
Software Program SAS
Software SAS
Macro Parameters
DSName=input SAS data set
GroupVar=two or more level numeric or alphanumeric grouping variable. Observations with missing values on this variable are deleted. If not present, then statistics are given for all data.
NumVars=list of numeric variables to be summarized with mean +/- SD or median (min-max). Shortcut listsOK.
FreqVars=list of numeric or alpha variables to be summarized with frequencies and/or percents. Alpha variables are allowed. Shortcut lists OK.
Mean=Y|N. If Y, then variables in NumVars are summarized with N, mean +/- SD. Default = Y.
Median=Y|N. If Y, then variables in NumVars are summarized with median (min-max). Default = N. If both Mean and Median are Y, then there will be two lines of output per variable in NumVars.
Total=R|C|N|RC. R generates a column of statistics across all levels of the grouping variable. C generates a row of totals for each variable in FreqVars. It has no effect on NumVars variables. RC generates both row and column totals. N suppresses both totals. Default = C.
P=T|W|N|TW. T generates p-values for variables in NumVars based on a pooled variances t-statistic. W generates p-values based on a Wilcoxon rank-sum statistic. TW generates both types of p-values. N suppresses p-values. Default = W.
Fisher=list of variables in FreqVars for which Fisher's exact test is to be used.
KW=list of variables in FreqVars for which a Wilcoxon rank-sum (or Kruskal-Wallis) test is to be used.
FreqCell=N|RP|CP|N(RP)|N(CP)|RP(N)|CP(N). Cell contents for categorical variables. N is frequency. RP is row percent. CP is column percent. Default is N(RP).
Missing=Y|N. If Y, then frequencies for variables listed in FreqVars will include rows for missing values. Default is N. The missing values are not included in p-value calculations. This parameter has no effect on variables in NumVars.
Print=Y|N. Default isY.
Label=N|L|NL. Controls labeling for variables in FreqVars. N for name, L for variable label, NL for both. Variables in NumVars always show only the variable label (which is the variable name if there is no label). Default = L.
Examples Label=N displays SEX, Label=L displays Subject gender, Label=NL displays SEX (Subject gender).
Out=output SAS data set to be printed with the Table1Print macro.
Out1way=output SAS data set to be created by the npar1way macro (2+ groups) or the univariate macro (1 group). If Print=Y, then the npar1way output or univariate output is also printed. If Print=N, then this data set can be printed with the npar1wayprint macro.
R-Code - Attachment
R-Code
SAS-Code - Attachment UCSF_Table 1_Main Macro
SAS-Code
Stata-Code - Attachment
Stata-Code
Other Code - Attachment
Other Code
Called Data Manipulation
Called Tool/Utility
Called Checking Macro
Called Other
Creation-Date
Revision-Date January 30, 2009
Example Code SAS Example Code
Example Output SAS Example Output
SAS Examples Example run using macro
SAS_Example_Code
SAS_Example_Output UCSF_Table 1 Macro_SAS Example Output
R Examples
R_Example_Code
R_Example_Output
Stats Examples
Special Features Printing
Special Features Attached UCSF_Table1 Macro_Print
Special Features Text Dsname = name of data set created by logistic macro
Space = Y/N. If Y, then a space is inserted after each variable. Spaces are always inserted after each model (Default = Y)

The table1 macro automatically calls the npar1way macro (2+ groups) or the univariate macro (1 group) for more detailed output. To suppress this output, select Print=N and create an output file with out=. Then use table1print to print this file.
Notes1-Legend Section with calls to needed macros
Notes1
Notes2-Legend Macro call with fully specified parameters
Notes2
Notes3-Legend Section with definitions of global macro parameters
Notes3
Notes4-Legend Section with definitions of local macro variables
Notes4
See Also
Checklists UCSF_Table 1 Macro_ Checklist
Stat Tools Disclaimer
Discliamer The views expressed within CTSpedia are those of the author and must not be taken to represent policy or guidance on the behalf of any organization or institution with which the author is affiliated.
Permission Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT OLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Reference Image
This topic: CTSpedia > WebHome > StatToolsHome > StatToolsTopic007
Topic revision: 20 Jul 2012, PeterBacchetti
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback