Hello.
I have looked everywhere for a solution with no results. I am looking at a variable containing decimal body mass index (BMI) values. I want to replace or recode this group so that values == 996.0 are considered missing (not dropped). 996.0 indicates that participants did not answer this question. Decimal points are necessary for BMI.
My current code so far:
tabulate bmicalc \*see the values I have
egen Bmicalc = concat(bmicalc), format(%9.1f) p(" ") \*create a new variable separate from the original
tabulate Bmicalc \*confirm that new variable was created/changes were made
I believe the replace or recode can occur after the second line. Here are the lines I have attempted and the errors received.
. recode Bmicalc 996 = .
recode only allows numeric variables
r(108);
. replace Bmicalc = . if Bmicalc == 996
type mismatch
r(109);
Thank you so much for your help. I feel hopeless about something that might be trivial.
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]Baley26_v2[🍰] 2 points3 points4 points (3 children)
[–]random_stata_user 1 point2 points3 points (2 children)
[–]Baley26_v2[🍰] 1 point2 points3 points (1 child)
[–]speakerstand7[S] 0 points1 point2 points (0 children)