* dm24: STB-23 program define t_crcs /* internal utility routine */ local options "Table(string) Row(string) COL(string) FONt(string)" parse "`*'" tempname tstripe local s `table'_str if ("`row'"=="") { local r $`table'_r } else if ("`row'"=="_all") { local r 0 } else { local r = rownumb("`table'_F","`row'") } if (`r'==.) { local r = rowsof("`table'_F") + 1 local cols = colsof("`table'_F") matrix `tstripe' = J(1,`cols',0) local n : rownames(`table'_F) local n "`n' `row'" matrix `table'_F = `table'_F \ `tstripe' matrix rownames `table'_F = `n' global `table'_$`s' `row' local k = colnumb("`table'_F","stub") matrix `table'_F[`r',`k'] = $`s' + 4096 global `s' = $`s' + 1 matrix `table'_V = `table'_V \ `tstripe' matrix `table'_M = `table'_M \ `tstripe' } if ("`col'"=="") { local c $`table'_c } else if ("`col'"=="_all") { local c 0 } else { local c = colnumb("`table'_F","`col'") } if (`c'==.) { local c = colsof("`table'_F") + 1 local rows = rowsof("`table'_F") matrix `tstripe' = J(`rows',1,0) local n : colnames(`table'_F) local n "`n' `col'" /* maybe call recursively here ?? */ matrix `table'_F = `table'_F , `tstripe' matrix colnames `table'_F = `n' global `table'_$`s' `col' local k = rownumb("`table'_F","stub") matrix `table'_F[`k',`c'] = $`s' + 4096 global `s' = $`s' + 1 matrix `table'_V = `table'_V , `tstripe' matrix `table'_M = `table'_M , `tstripe' } if ("`font'"=="") { if (`r'==1 | `c'==1) { local font green } else { local font yellow } } local i = length("`font'") if ("`font'"==substr("green",1,`i')) { local font 1 } if ("`font'"==substr("yellow",1,`i')) { local font 2 } if ("`font'"==substr("white",1,`i')) { local font 3 } if ("`font'"==substr("blue",1,`i')) { local font 4 } if ("`font'"==substr("red",1,`i')) { local font 5 } global S_t `table' global `table'_r = `r' global `table'_c = `c' global `table'_f = `font' end