 He was commissioned on May 24, 1779, as first lieutenant, Fifth Battalion, Sixth Company.He served as justice of the peace in Charlestown Township for several years, and was a member of the Pennsylvania House of Representatives in 1801.Anderson was elected as a Republican to the Eighth and Ninth Congresses.