Recodage d'une variable quantitative en une variable qualitative

Publié le par Marc

1. Aller dans le module "Analysis",
2. ouvrir la base avec une commande READ
3. Définir une nouvelle variable avec DEFINE
4. Utiliser RECODE pour définir les modalités de cette variable

Exemple: supposons que vous vouliez recoder une variable quantitative
"age" en une variable qualitative "ageclass"

DEFINE ageclass
RECODE age TO ageclass
   0 - 15       = "0-15"
   16 - 30      = "16-30"
   30 - HIVALUE = ">30"
END

Voir l'aide de la commande RECODE pour plus d'explications et un exemple.

Il y a aussi une boîte de dialogue pour faire cela à la souris
.

AIDE EPI INFO

RECODE

Command

 Description

This command is used to change some or all values of a variable. The new values can be stored in the same variable or in a new one. It can also be used to convert a numeric variable into a character variable or the reverse, or to create a new variable based on recoded values of an existing variable.

Syntax

RECODE <Variable1> TO <Variable2>

Value1 - Value2 = <Recoded Value>

Value1 – HIVALUE = <Recoded Value>

LOVALUE - Value2 =  <Recoded Value>

Value3 = <Recoded Value>

ELSE= <Recoded Value>

END

 he <Variable1> represents the donor variable (where the values are)

 The <Variable2> represents the receiver variable (where recoded values will be)

Comments

Text values must be enclosed in quotation mars; numeric, date and yes/no values must not be. All recoded values must be of the same type.  Numeric ranges are separated by a space, hyphen, and space, as in 1 - 5.    Negative values are permitted, as in  -10, -9 – -8.  The words LOVALUE and HIVALUE may be used to indicate the smallest and largest values representable in the database.  The word ELSE may be used to indicate all values not falling in the preceding ranges.  Recodes take place in the order stated; if two ranges overlap, the first in order will apply.

RECODE AGE TO var1

            LOVALUE - 0 = "<=0"

            0 - 10 = ">0 - 10"

            10 - 20 = ">10 - 20"

            20 - 30 = ">20 - 30"

            30 - 40 = ">30 - 40"

            40 - 50 = ">40 - 50"

            50 - 60 = ">50 - 60"

            60 - 70 = ">60 - 70"

            70 - 80 = ">70 - 80"

            80 - 90 = ">80 - 90"

            90 - 99 = ">90 - 99"

            99 - HIVALUE = ">99"

END

Publié dans Les Astuces

Pour être informé des derniers articles, inscrivez vous :
Commenter cet article