Suppose I have the following table:
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:
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
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?
| ID | Preferences |
| 1 | 2 |
| 1 | . |
| 1 | . |
| 2 | . |
| 2 | 3 |
| 3 | . |
| 3 | . |
| 3 | 4 |
| 4 | 1 |
| ID | Preferences |
| 1 | 2 |
| 2 | 3 |
| 3 | 4 |
| 4 | 1 |
Code:
drop Preferences if Preferences != .
How can I do this?

Comment