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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.