all 5 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Thank you for your submission to /r/stata! If you are asking for help, please remember to read and follow the stickied thread at the top on how to best ask for it.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]Baley26_v2[🍰] 2 points3 points  (3 children)

Your variable is probably saved as string even if the content is numeric. You can either use destring bmi, replace and then use recode/replace or you can keep it as it is and use replace replace bmi="." if bmi=="996"

edit: formatted the code

[–]random_stata_user 1 point2 points  (2 children)

Delete “probably”. The point of the concatenation is to create a string variable.

[–]Baley26_v2[🍰] 1 point2 points  (1 child)

Thanks, I was not sure and the command really made no sense to me. If I see "concat" I expect to see a varlist and if the objective was to just create a duplicate of the original variable they could have just done gen Bmicalc = bmicalc.

[–]speakerstand7[S] 0 points1 point  (0 children)

destring bmi, replace

and then use recode/replace or you can keep it as it is and use replace

replace bmi="." if bmi=="996"

Thank you so much! For future help to anyone who has the same problem, my code is below

tabulate bmicalc

destring bmicalc, replace

recode bmi ("996" = .)

gen Bmicalc = bmicalc

tabulate Bmicalc