Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    it seems that someone has developed a new module "recode12" as the solution on the SSC.

    Title: recode12 -- Standardize 1/2-coded variables as labeled 0/1 indicators

    Syntax: recode12 [varlist], yesvalue(#) [suffix(name) replace]

    Description:recode12 identifies numeric variables whose values are 1, 2, or ordinary system missing (.), with both 1 and 2 observed. Variables containing an extended missing value (.a through .z), any other numeric value, only one of the two categories, or no nonmissing observations are skipped.

    For each eligible variable, recode12 maps the source value selected by yesvalue() to 1 and the other source value to 0, preserves numeric missing values, and assigns the value label 0 No and 1 Yes. The required yesvalue() option records the mapping explicitly. By default, the command creates a new byte variable and leaves the source variable unchanged.

    If varlist is omitted, all numeric variables in the dataset are examined. The mapping must still be specified with yesvalue().

    After recoding, the command verifies every converted observation against the selected mapping, confirms that ordinary system missing values were preserved, and confirms that every nonmissing result is 0 or 1. It reports success only after all verification checks pass.
    Last edited by smith Jason; 16 Jul 2026, 01:38.

    Comment

    Working...
    X