I would like to be able to produce a simple "Table 1" with baseline values of a couple of patient groups. That means listing a number of variables as rows with frequencies and percentages, divided into two columns by a group variable. But I am struggling.
Why doesn't the following code work?
Thanks for any help.
Why doesn't the following code work?
- If run 'as is', it will not work. I receive an error message
- If I leave out one of the 'statistic' options (no matter which) within the loop, the aggregated table will show, provided that no 'statistics' options are present in the first tabulation (cprSex). Sometimes the cprSex variable will be included in the table, but not always
Thanks for any help.
Code:
local predAlle_tab "cprSex BMIkat genstande arvelighed aldersGrp rygning asa performance CCIkat lokalisationRectum mdt_konf afdnummerVol region" quietly table cprSex OverTx, statistic(freq) statistic(perc, across(OverTx)) foreach var in `predAlle_tab' { quietly table `var' OverTx, statistic(freq) statistic(perc, across(OverTx)) append } collect layout (`predAlle_tab') (OverTx)
Comment