Data Gas;
Infile datalines;
Input Month NE_Price NY_Price @@;
datalines;
1 2.07 2.44 2 2.20 2.40 3 2.48 2.56 4 2.72 2.77
5 2.75 2.89 6 2.62 2.79 7 2.61 2.80 8 2.52 2.75
9 2.48 2.66 10 2.48 2.6 11 2.47 2.60 12 2.42 2.59
;
run;
Proc format;
value monfmt 1='Jan' 2='Feb' 3='Mar' 4='Apr'
5='May' 6='Jun' 7='Jul' 8='Aug'
9='Sep' 10='Oct' 11='Nov' 12='Dec';
Run;
proc print data=Gas;
format Month monfmt.;
run;
Title '2019 Gasoline Prices';
Title2 'New York Vs. Nebraska';
Proc sgplot data=Gas noautolegend;
band x=month upper= NY_Price lower=0/fillattrs=(color=salmon)
curvelabelupper='NY';
series x=month y=NY_Price/ markers markerattrs=(symbol=diamondfilled color=blue)
lineattrs=(color=salmon);
band x=month upper= NE_Price lower=0/fillattrs=(color=cream)
curvelabelupper='NE';
series x=month y=NE_Price/ markers markerattrs=(symbol=trianglefilled color=red)
lineattrs=(color=cream);
Yaxis Label="Price of a Gallon of Gas" min=2;
xaxis type=discrete;
format Month monfmt.;
run;
Title;
Title2;
Add a HIGHLOW plot
Something like:
Title '2019 Gasoline Prices';
Title2 'New York Vs. Nebraska';
Proc sgplot data=Gas noautolegend;
band x=month upper= NY_Price lower=0/fillattrs=(color=salmon)
curvelabelupper='NY';
series x=month y=NY_Price/ markers markerattrs=(symbol=diamondfilled color=blue)
lineattrs=(color=salmon);
band x=month upper= NE_Price lower=0/fillattrs=(color=cream)
curvelabelupper='NE';
series x=month y=NE_Price/ markers markerattrs=(symbol=trianglefilled color=red)
lineattrs=(color=cream);
highlow x=month high=ny_price low=ne_price /
lineattrs=(color=green);
Yaxis Label="Price of a Gallon of Gas" min=2;
xaxis type=discrete;
format Month monfmt.;
run;
Title;
Add a HIGHLOW plot
Something like:
Title '2019 Gasoline Prices';
Title2 'New York Vs. Nebraska';
Proc sgplot data=Gas noautolegend;
band x=month upper= NY_Price lower=0/fillattrs=(color=salmon)
curvelabelupper='NY';
series x=month y=NY_Price/ markers markerattrs=(symbol=diamondfilled color=blue)
lineattrs=(color=salmon);
band x=month upper= NE_Price lower=0/fillattrs=(color=cream)
curvelabelupper='NE';
series x=month y=NE_Price/ markers markerattrs=(symbol=trianglefilled color=red)
lineattrs=(color=cream);
highlow x=month high=ny_price low=ne_price /
lineattrs=(color=green);
Yaxis Label="Price of a Gallon of Gas" min=2;
xaxis type=discrete;
format Month monfmt.;
run;
Title;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.