- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
binary recoding
How can I simply recode a colum with numeric or missing values into a binary code?
I simply wanto to know, if there is any entry ("1") or none ("0").
For this purpose I would like to recode the colum by recoding "missing value" to "0" and any other numeric value to "1".
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: binary recoding
Names Default To Here (1);
dt = current data table();
// Nouvelle colonne : TEST
dt << New Column( "TEST",
Numeric,
"Continuous",
Format( "Best", 12 )
);
// Modifier la formule de colonne : TEST
dt:TEST << Set Formula(
If( !Is Missing( :data ),
:TEST = 1,
:TEST = 0
)
);
Vous pouvez rechercher les valeurs manquantes de la BD suivante :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: binary recoding
Just using Not(IsMissing()) should be enough
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(5),
Compress File When Saved(1),
New Column("Column 1",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([., 2, ., 5, .])
)
);
dt << New Column("Check", Numeric, Nominal, Formula(
!IsMissing(:Column 1)
));
And if you want to have then as characters wrap that with Char()
Char(!Is Missing(:Column 1))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: binary recoding
can you give an example?
This post originally written in French and has been translated for your convenience. When you reply, it will also be translated back to French .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: binary recoding
I would use a simple script to do the change.
If you have a column of data that contains zeros and other values
You can use this simple script to change the values
For Each Row(
If( :Y == 0, :Y = 0, :Y = 1 )
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: binary recoding
Names Default To Here (1);
dt = current data table();
// Nouvelle colonne : TEST
dt << New Column( "TEST",
Numeric,
"Continuous",
Format( "Best", 12 )
);
// Modifier la formule de colonne : TEST
dt:TEST << Set Formula(
If( !Is Missing( :data ),
:TEST = 1,
:TEST = 0
)
);
Vous pouvez rechercher les valeurs manquantes de la BD suivante :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: binary recoding
Just using Not(IsMissing()) should be enough
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(5),
Compress File When Saved(1),
New Column("Column 1",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([., 2, ., 5, .])
)
);
dt << New Column("Check", Numeric, Nominal, Formula(
!IsMissing(:Column 1)
));
And if you want to have then as characters wrap that with Char()
Char(!Is Missing(:Column 1))