Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72790

deleting obs if var1=var2

$
0
0
Dear All
I have the attached dataset and i have 2 questions:

1. I want to order STATA to drop all the observations for which the values of var "countryisocode_NUM" equal the values of var "guocountry". WHICH command do i need to use?
e.g. in the dataset attached i want to drop all obs where
countryisocode_NUM = guocountry and keep the rest as they are.

2. I want to order stata to replace all the missing values of variable "guocountry" with the values that correspond to "countryisocode_NUM" for that particular observation. which command i use? i tried with replace but it works only if you want to replace an obs with a specific value each time but i want to order stata to replace it with the value in the next variable.
e.g. in the dataset attached, in obs number 3, i want to replace the missing value of guocountry with the value at
countryisocode_NUM i.e. "HR". and i want to write a command that does this for the whole dataset.

thanks a lot in advance for the help
​Marialena

Viewing all articles
Browse latest Browse all 72790

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>