statastudent
statastudent

Reputation: 1

How can I replace one string variable in any row with a particular value?

Within rfcolumn, I am trying to replace all values of "bad" with "good".

I have used the command:

replace rfcolumn = "good" in 10

and this will replace "good" with "bad" in row 10.

Upvotes: 0

Views: 404

Answers (1)

Nick Cox
Nick Cox

Reputation: 37338

Stata is not a spreadsheet application: the terminology of rows and columns is used only for matrices. Sure, it is possible to translate, but using non-Stata terminology in Stata is to be avoided as much as the reverse. For columns, always say variables; for rows, always say observations.

To replace all values equal to "bad" with "good"

replace rfcolumn = "good" if rfcolumn == "bad"  

Upvotes: 1

Related Questions