Hi Statalist,
I have a dataset with latitude/longitude collected twice for each household and thus is contained in 2 variables for both latitude and longitude. Due to cloud covering, many of the lat/lon values are missing and in an inconsistent manner. That is, some observations have data for all 4 variables, some only for lat1/lon1, some only for lat2/lon2. What's the most efficient loop that will:
I have a dataset with latitude/longitude collected twice for each household and thus is contained in 2 variables for both latitude and longitude. Due to cloud covering, many of the lat/lon values are missing and in an inconsistent manner. That is, some observations have data for all 4 variables, some only for lat1/lon1, some only for lat2/lon2. What's the most efficient loop that will:
- If all 4 variables !=. --> take the average of each of the two lat/lon variables and place in a new variable
- If only lat1/lon1 data !=. --> populate the new variable generated above with this data
- If only lat2/lon2 data!=. --> same as above
Comment