Just days before Veterans Day is observed, a new analysis ranked two Valley cities in the top 20 for best places for veterans to live.

According to WalletHub, Scottsdale and Gilbert are good places for veterans to live, ranking 12 and 20 on a list comparing the 100 most populated U.S. cities.

WalletHub looked at factors categorized under jobs, economy, quality of life and health. More specifically, the number of jobs available, veteran unemployment rate, housing affordability, median veteran income, homelessness rate among veterans, veteran population and veteran health resources and facilities were analyzed to determine the rankings.

Scottsdale has good quality of life factors for veterans, according to the analysis, while Gilbert had better economic factors. Chandler trailed the top 20 cities at number 22.

Other Valley cities didn’t rank as high. Mesa ranked 58, Glendale, 67 and Phoenix, 76. Those cities, according to the analysis, received poor scores in the jobs, economy and health categories. For example, WalletHub said it found a veteran must wait an average of 115 days before seeing a mental health professional in Phoenix.

To view the full list, click here.