BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sb1062204
Calcite | Level 5

Screen Shot 2020-11-09 at 3.54.42 PM.png

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; 
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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; 

View solution in original post

1 REPLY 1
ballardw
Super User

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; 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 449 views
  • 1 like
  • 2 in conversation