Hey everyone. Consider the following two frames of data. The first is imported from my Google Drive, given to me by a colleague, the second from the Correlated of State Policy Database at IPPSR of Michigan State.
What I want.... is to keep the variables in frame fulldata, on the condition that they are present in frame main. So, for example, total_expenditure_inc total_expenditure are both in each data frame, therefore, they both should stay in frame two and all the other ones be dropped. I didn't want to go through each predictor and check and see if it was there, I wanted to see if a more systematic way existed. How might I start this?
Code:
clear * capture program drop gsheet program define gsheet syntax anything , key(string) id(string) local url "https://docs.google.com/spreadsheets/d/`key'/export?gid=`id'&format=csv" copy "`url'" `anything', replace noi disp `"saved in `anything'"' import delim using `anything', clear erase `anything' end gsheet "`c(pwd)'\\test.csv" , key("12BT6vxYDf_00k6CjJPyuKY7LBs5L-ljVC8ORB6APXeQ") id("542334262") frame rename default main frame create fulldata frame change fulldata cls import delim "https://ippsr.msu.edu/sites/default/files/cspp/correlates2-6.csv", clear varn(1) bindquote(strict) keep if inrange(year,1970,2000)
Comment