With following data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(disease_experience drought_experience flood_experience disease_prediction drought_prediction flood_prediction) 1 3 1 2 1 3 2 4 3 3 3 4 3 5 4 4 6 5 4 6 5 1 7 6 end
Code:
unab experience : *_experience
local experience: subinstr local experience "_experience" "", all
unab prediction : *prediction
local prediction : subinstr local prediction "_prediction" "", all
local prefixes : list experience & prediction
foreach s of local prefixes {
pwcorr `s'_experience `s'_prediction, sig
}
Would any tweaking in the code help me get what I wanted?
0 Response to Looping correlation between variables
Post a Comment