Can one consecrate one's country? Arguably, it is a difficult thing to do: not everyone in the country believes in God or prays, and one cannot act on their behalf.
Personal or group consecrations are more common, but, because a consecration demands free will, strictly speaking, when we deal with the consecration of a country, we have to speak of a votive consecration: in this case not a formal consecration (which requires consent), but an intercession for the country .
It is an excellent thing to consecrate one's country, for just as sin is personal but has social consequences, so the prayer of consecration is personal but has social consequences. The consecration to Jesus by the hands of Mary works miracles in the lives of Christians, but also in the life of a country.
Pope Saint John Paul II set an example for the consecration of nations:
"All sin is personal from a certain point of view, and from another point of view, all sin is social in that, and because, it also has social consequences ...
It is in the hands of this Mother—to whom we have repeatedly entrusted the whole human race perturbed by sin and torn by so many tensions and conflicts—and to her Immaculate Heart, that I especially entrust this intention: through her intercession, may the human race discover and travel the path of penance, the only path capable of leading it to total reconciliation!"
 Cf. R. LAURENTIN, Retour à Dieu avec Marie, OEIL, Paris 1991, p. 79-88