Hi Statalisters,
I've put together a programme to assign members of my organization to QA documents (i know, i work in esteemed company). It's returning the error that the variable id already exists though, even though at the beginning of the programme it clears existing data.
I haven't saved it in my personal folder yet, but I should be able to just run it as a do-file and run it thusly
Any ideas what's going wrong?
I've put together a programme to assign members of my organization to QA documents (i know, i work in esteemed company). It's returning the error that the variable id already exists though, even though at the beginning of the programme it clears existing data.
Code:
*! version 1.1 10 Feb 2017 Chris Larkin
capture program drop whoforqa
program whoforqa
syntax [, SEED(int)]
qui{
preserve
forvalues i = 1/15{
noisily di " "
}
clear
input str18 firstname str18 lastname
"Jeff" "Bridges"
"Leonardo" "Di Caprio"
"Jack" "Nicholson"
"Samuel" "Jackson"
"Orlando" "Bloom"
"Johnny" "Depp"
"Nicolas" "Cage"
"Robert" "De Niro"
"Chris" "Larkin"
end
sort firstname lastname
gen id = _n
set seed `seed'
gen rand = runiform()
egen rank = rank(rand)
noisily: di in red "And the person doing the QA is...."
noisily: li firstname lastname if rank==_N, noheader clean noobs
forvalues i = 1/15{
noisily di " "
}
restore
}
Code:
sysuse auto, clear whoforqa
Any ideas what's going wrong?

)
Comment