Q. In formal writing, I have been shown by my coworkers that U.S. is the way to write United States. However, I was always told that very few abbreviations are to be used in formal writing, and the abbreviation U.S. should never be used in replacement of United States when writing federal documents.
A. Until the 17th edition, Chicago style was to spell out the noun in running text, but abbreviate the adjective as US. Now, we allow US as a noun, but only if the meaning is clear from context—that is, the usage is subject to editorial discretion. See CMOS 10.32. (Note that the federal government doesn’t necessarily follow Chicago style, however!)