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 (minmax). 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=YN. If Y, then variables in NumVars are summarized with N, mean +/ SD. Default = Y. Median=YN. If Y, then variables in NumVars are summarized with median (minmax). Default = N. If both Mean and Median are Y, then there will be two lines of output per variable in NumVars. Total=RCNRC. 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=TWNTW. T generates pvalues for variables in NumVars based on a pooled variances tstatistic. W generates pvalues based on a Wilcoxon ranksum statistic. TW generates both types of pvalues. N suppresses pvalues. 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 ranksum (or KruskalWallis) test is to be used. FreqCell=NRPCPN(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=YN. 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 pvalue calculations. This parameter has no effect on variables in NumVars. Print=YN. Default isY. Label=NLNL. 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. 
RCode  Attachment 

RCode 

SASCode  Attachment  UCSF_Table 1_Main Macro 
SASCode 

StataCode  Attachment 

StataCode 

Other Code  Attachment 

Other Code 

Called Data Manipulation 

Called Tool/Utility 

Called Checking Macro 

Called Other 

CreationDate 

RevisionDate  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. 
Notes1Legend  Section with calls to needed macros 
Notes1 

Notes2Legend  Macro call with fully specified parameters 
Notes2 

Notes3Legend  Section with definitions of global macro parameters 
Notes3 

Notes4Legend  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 
