Suppose I have the following table:
ID |
Preferences |
1 |
2 |
1 |
. |
1 |
. |
2 |
. |
2 |
3 |
3 |
. |
3 |
. |
3 |
4 |
4 |
1 |
I have other columns before 'ID' and after 'Preferences'. What I want to get is two columns of the following type on the right of the above table:
ID |
Preferences |
1 |
2 |
2 |
3 |
3 |
4 |
4 |
1 |
In other words, I want to delete the missing values of the variable 'Preferences'. I don't want to delete observations. I only want to record 'Preferences' with non-missing values. So
Code:
drop Preferences if Preferences != .
would not work in this case. This would delete observations with missing values for Preferences, which is not what I want.
How can I do this?
0 Response to Deleting the missing values (not entire observations) of a variable
Post a Comment