LAB3: replace VS recode

LAB3: replace VS recode

by Thongchai -
Number of replies: 4

Question 19

"Now recode (or replace) the 9’s (and the actual missing values) as missing."

I do not understand the different between "replace" and "recode" to use in this part.

In reply to Thongchai

Re: LAB3: replace VS recode

by Bardia -

You can use either replace or recode commands to achieve the same results. You don't need to use both. Let me know if you need the exact syntax.

In reply to Bardia

Re: LAB3: replace VS recode

by Tiffany Ho -

could you explain the exact difference between replace and recode? for the complex logicals section of lab3, using recode instead of replace gave me errors 

In reply to Thongchai

Re: LAB3: replace VS recode

by Megha Mehrotra -

More broadly, you cannot use recode for string variables, whereas replace would work with strings as well as numeric variables. 

In this case, since it's numeric, it doesn't matter which one you use. Both will work, and it's really a matter of personal preference.

 

Megha