Its decoded from the MMSI....
We are just getting set to install an AIS transceiver (in the box in the v-berth, waiting for other projects) and I got interested in how my flag will be displayed (if at all) with my Class B....Here is what I found digging on the internet...
The Flag is decoded from the first three numbers of your MMSI. Those characters are called the Maritime Identification Digits. The first digit is the geographic region of the world (North America=3, Australia is listed under Oceania=5.) The second and third digits are country specific. What I've read is that when 80% of the numbers in a MID are used, a new one will be issued to the country. The USA has 8 in the North America Region, two in territories in the Oceania region:
303 (United State of America - State of Alaska)
338 (United States of America)
358 (United States of America - Puerto Rico)
366, 367, 368, 369 (United States of America)
379 (United States of America - US Virgin Islands)
536 (United States of America - Northern Mariana Islands)
559 (United States of America - American Samoa)
I'm guessing most of the continental US members on here have an MMSI that starts with 338, 366,367,368,369. No explanation why Alaska has its own, other than some of the off the continental territories do, too....
Here are my sources if you want to dig more....
USCG site explaining MMSI codes...
https://www.navcen.uscg.gov/?pageName=mtmmsi
ITU website listing all MID codes (ITU assigns them...)
https://www.itu.int/en/ITU-R/terrestrial/fmd/Pages/mid.aspx