isid
Checks that a column (or a set of them) identifies each row uniquely.
What we have
- one variable or several, checked for uniqueness
Coming later
Nothing known to be missing.
How you write it
isid varlist
Square brackets mean optional. A vertical bar means choose one.
What it does
"Is this an ID?" — isid id passes silently if no two rows share an id, and stops with an error if any do.
Worth running before every merge 1:1, because a merge that assumes one row per key and meets two will either fail or, worse, quietly multiply your data.
Try it
Every example below was run after sysuse vira.sample03, clear.
. isid id
The same thing in pandas and in R
R
# no R form for `isid` yet -- see docs/r-equivalents.md