Factors associated with waiting time for surgery