generated from opensafely/research-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'load-match-cohorts' of https://github.com/opensafely/po…
…st-covid-thrombosis-research into load-match-cohorts
- Loading branch information
Showing
11 changed files
with
112 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
cap prog drop safecount | ||
prog define safecount, byable(recall) rclass | ||
|
||
marksample touse | ||
local if " if `touse'" | ||
|
||
local ifpos = strpos("`0'", "if ") | ||
local inpos = strpos("`0'", "in ") | ||
|
||
if `inpos'==1 & `ifpos'>0 { | ||
noi di in red "if cannot be combined with in" | ||
error 999 | ||
} | ||
|
||
if `ifpos'>0{ | ||
local if "`0' & `touse'" | ||
local if "`if' & `touse'" | ||
} | ||
|
||
if `inpos'==1{ | ||
local in = substr("`0'", `inpos',.) | ||
} | ||
|
||
qui cou `if' `in' | ||
if (r(N)>5 | r(N)==0) { | ||
count `if' `in' | ||
scalar count = r(N) | ||
} | ||
else { | ||
scalar count = . | ||
noi di in yellow _n "** COUNT <=5 **" | ||
} | ||
return scalar N = count | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
cap prog drop safetab | ||
prog define safetab, byable(recall) | ||
|
||
marksample touse | ||
local if " if `touse'" | ||
local commapos = strpos("`0'", ",") | ||
local commaposm1 = `commapos'-1 | ||
|
||
if `commapos'>0 { | ||
local main = substr("`0'", 1, `commaposm1') | ||
local options = substr("`0'", `commapos', .) | ||
} | ||
else local main `0' | ||
|
||
local ifpos = strpos("`main'", " if ") | ||
local ifposm1 = `ifpos'-1 | ||
|
||
local inpos = strpos("`main'", " in ") | ||
local inposm1 = `inpos'-1 | ||
|
||
if `inpos'>0 & `ifpos'>0 { | ||
noi di in red "if cannot be combined with in" | ||
error 999 | ||
} | ||
|
||
if `ifpos'>0{ | ||
local if = substr("`main'", `ifpos', .) | ||
local if "`if' & `touse'" | ||
local main = substr("`main'", 1, `ifposm1') | ||
} | ||
|
||
if `inpos'>0{ | ||
local in = substr("`main'", `inpos',.) | ||
local main = substr("`main'", 1, `inposm1') | ||
} | ||
|
||
qui tab `main' `if' `in', matcell(T) | ||
m: T=st_matrix("T") | ||
m: T=(T:+(10:*(T:==0))) | ||
m: st_numscalar("checkmin", min(T) ) | ||
|
||
|
||
if checkmin>5 tab `main' `if' `in' `options' | ||
else noi di _n "**TABLE OF `main' REDACTED DUE TO SMALL N**" _n | ||
|
||
end |
File renamed without changes.
File renamed without changes.