Getting error message in .dat file

This is the first line in 1-1a.dat from the AMPL book:
MEDIA is not a set
context: set >>> MEDIA <<< := TV MAG ;

Why is AMPL not recognizing that I am defining the set in the .dat file? How do I correct it?

You need to read the model file before you read the data file.