I have written a macro that takes storm data from a particular year and then plots points of latitude and longitude for the storms colored by what type they were (status variable). Many years do not have every type of storm, so when I change the year in the macro, the legend and scatter plot colors are almost always different. Ideally, I would like to be able to assign a color to each level of the "status" variable and have it be consistent from year to year (for example, I want to keep that bright blue for all graphs that have "HU"). Below is my code and a picture of the plot for the year 2017. I'm using a version of SAS 9.4 available through my university (it is limited and missing several libraries). %macro hurricaneMap(year=2017);
proc sgplot data=weather3;
series x=long y=lat / group=cyclone_num lineattrs=(pattern=Solid color=grey);
scatter x=long y=lat / group=status markerattrs=(size=6 symbol=Circle);
keylegend / title="Storm Classification" exclude=("01" "02" "03" "04"
"05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19"
"20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31");
xaxis label="Longitude" values=(-110 to 0 by 10);
yaxis label="Latitude" values=(0 to 70 by 10);
title "&year. Atlantic Basin Storm Summary Map";
where year=&year.;
run;
%mend;
%hurricaneMap(year=2017);
... View more