Ok, in that case I'll state it here.
Let's import this document as an example:
With Nick's suggested code, I get the number of games a team has played only on home/away, I mean, only taking one column into consideration.
I can't think of a way to ask STATA to look for the amount of times a team has played either home or away, which is, looking in both columns.
Let's import this document as an example:
import delimited "https://fixturedownload.com/download/nba-2018-EasternStandardTime.csv", clear
gen long id = _n
bysort home (id) : gen gamesPlayed = _n - 1
sort id
bysort home (id) : gen gamesPlayed = _n - 1
sort id
Comment