Paper AD13
COL= group variable. Missing observations will be excluded from the table (required).
TEST= type of test for each corresponding variable in row if the p-value is needed (optional).
t-test, ANOVA test, and Wilcoxon Rank Sum test can be chosen for continuous variables;
Pearson’s chi-square test, Fisher’s exact test, likelihood ratio chi-square test, and Kruskal-Wallis test
can be chosen for categorical variables.
PCT= specifies the percentage to be printed for categorical variables (required)
row – row percentage will be printed; col – column percentage will be printed
RTFFILE= specifies the path and the file name for the summary table (required).
TITLE= the title for the summary table (optional).
PAGE= the layout page direction: landscape or portrait (optional). Default is portrait.
PGS= the number of rows on each page (optional). The default value is 20.
FEATURES
1) CLEAN INTERFACE
You need only enter a few parameters to the macro to generate the table. These parameters are straightforward and
easy to understand. Even though the macro program consists of several programs, you only need to interact with
macro function “%SummaryTable” as described above.
2) FLEXIBLE AND POWERFUL TO GENERATE OUTPUTS IN A DESIRABLE LAYOUT AND FORMAT
You can choose the corresponding type of test for each variable of interest to print the p-values. If you do not need
the p-values, then input “NA” as the value of parameter “test”. To control how the percentage is calculated, you just
needs to choose value of parameter “pct” from “col” and “row”. Missing values of the row variables will be included in
percentage calculations and printed in a separate row, but be excluded from tests, which will highly help you to
control the desirable comparisons.
The outputs layout can be totally decided through the macro function parameters, which include the number of row in
each page, page orientation (portrait or landscape), and the output order of variables. The format and label for each
column variable and row variable can be controlled through the input data set, and if there are no specified labels,
the variable’s name will be used.
TECHNICAL DETAILS
STEP1. READ IN DATA
All the column variables and row variables will be read in through the macro call (%var1). Each row variable, based
on the type of variable (categorical or continuous), will be passed to two different macro functions: %cont_file and
%cate_file, which will generate descriptive statistics for each variable and save them in a data set.
%LET J=1;
%LET ROWJ=%UPCASE(%SCAN(&ROW,&J));
%DO %WHILE(%LENGTH(&ROWJ) > 0);
%LET RTYPEJ=%UPCASE(%SCAN(&RTYPE,&J));
%LET TESTJ=%UPCASE(%SCAN(&TEST,&J));
%VAR1(DATA=&DATA, ROW=&ROWJ, COL=&COL, RTYPE=&RTYPEJ, TEST=&TESTJ,
TABLE=&TABLE);
%LET J=%EVAL(&J + 1);
%LET ROWJ=%UPCASE(%SCAN(&ROW,&J));
%END;
……
%MACRO VAR1(DATA=, ROW=, RTYPE=, COL=, TEST=, TABLE=_STORE);
……
%IF &RTYPE=CONT %THEN %DO;
%CONT_FILE(DATA=&DATA, ROW=&ROW,COL=&COL);
%END;
%ELSE %IF &RTYPE=CATE %THEN %DO;
%CATE_FILE(DATA=&DATA, ROW=&ROW,COL=&COL);
%END;
……
%MEND;
Part of the SAS Macro for input of variables
Page 2 of 7
评论0
最新资源