Skip to content

Instantly share code, notes, and snippets.

@Aphoh
Created November 24, 2016 19:43
Show Gist options
  • Save Aphoh/ec1839fffb37b7f1d7b4e7249e8ebc87 to your computer and use it in GitHub Desktop.
Save Aphoh/ec1839fffb37b7f1d7b4e7249e8ebc87 to your computer and use it in GitHub Desktop.
// High quality
// Price range 1
gen best_one = .
set trace on
mkmat *_5_1, matrix(food_5_1)
forvalues i=1/56 {
local max_5_1 = food_5_1[`i',1]
forvalues t=1/37{
local aux = food_5_1[`i',`t'+1]
if (`max_5_1'<= `aux'){
local max_5_1 = `aux'
replace best_one = `t'+1 if _n==`i'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment