Hi everyone,
I am relatively new to Stata, so this is likely a basic question. I searched in Stata help file and the forum history, but couldn't find anything specific to string variables.
I have two datasets, one for quantities and one for prices. They have overlapping countries, but are not exactly the same. Under each country, there are industry data, and the industries are also different in each dataset. The good news is the country variables in both datasets use the same code, say country in quantities data contains: ARG BRA CAN MEX USA, and country in prices data contains: ARG CAN JPN USA
I would like to get a sense of how much overlap there is between the datasets. My thoughts are to start with the quantity dataset, and keep the values if a certain country is also in the prices dataset. Something like this:
What is the Stata commend that can achieve the last line "keep if the country is in the local price_country"?
Appreciate your help.
I am relatively new to Stata, so this is likely a basic question. I searched in Stata help file and the forum history, but couldn't find anything specific to string variables.
I have two datasets, one for quantities and one for prices. They have overlapping countries, but are not exactly the same. Under each country, there are industry data, and the industries are also different in each dataset. The good news is the country variables in both datasets use the same code, say country in quantities data contains: ARG BRA CAN MEX USA, and country in prices data contains: ARG CAN JPN USA
I would like to get a sense of how much overlap there is between the datasets. My thoughts are to start with the quantity dataset, and keep the values if a certain country is also in the prices dataset. Something like this:
Code:
sysuse quantity, clear local price_country ARG CAN JPN USA keep if "the country is in the local price_country"
Appreciate your help.
Comment