I have a dataset which is like this:
new_fish old_fish 1 2 4 3 And I want to make a column called status, where if new_fish is empty call it dead, and if old_fish is empty call it born, and if neither are empty call it alive.
I would want it to look like this:
new_fish old_fish status 1 2 alive 4 dead 3 born I've tried the following code in sas,
data diff_withclass; set diff; if missing(new_fish) then status= 'dead'; if missing(old_fish) then status= 'born'; else status = 'alive'; run; However, this doesn't work. It just sets status to alive.
ANy suggestions would be great.
https://stackoverflow.com/questions/66629586/trying-to-make-a-new-column-conditional-on-whether-other-columns-are-empty March 15, 2021 at 05:09AM
没有评论:
发表评论