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

Hello,

 

I am creating a plot and there a request to show a band from 100 to 150 to show reference values.

The y-axis has values ranging from 0 to 250 and x-axis is weeks. What is the best way to show a band

using proc template ? I am using SAS 9.4M2

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

The GTL supports the BANDPLOT statement. Thus you could write:

 

proc template;
  define statgraph bandplot;
    begingraph;
      layout overlay;
        bandplot x=height limitlower=100 limitupper=150 /
          name="band" 
          legendlabel="Overweight";		
        scatterplot x=height y=weight / primary=true;
        discretelegend "band";
      endlayout;
    endgraph;
  end;
run;

proc sgrender data=sashelp.class template=bandplot;
run;

However, you might consider using a BLOCKPLOT statement instead. See the example in the article "Overlay categories on a histogram."

View solution in original post

4 REPLIES 4
ballardw
Super User

It helps to show what you are starting from.

 

Likely you will be looking at a REFERENCELINE statement or two. It may be as simple as

 

Referenceline y=100;

Referenceline y=150;

 

but where the statments go may depend on what else you are attempting.

Leo9
Quartz | Level 8

I need a band extending from 100 to 150 not two reference lines. 

 

Rick_SAS
SAS Super FREQ

The GTL supports the BANDPLOT statement. Thus you could write:

 

proc template;
  define statgraph bandplot;
    begingraph;
      layout overlay;
        bandplot x=height limitlower=100 limitupper=150 /
          name="band" 
          legendlabel="Overweight";		
        scatterplot x=height y=weight / primary=true;
        discretelegend "band";
      endlayout;
    endgraph;
  end;
run;

proc sgrender data=sashelp.class template=bandplot;
run;

However, you might consider using a BLOCKPLOT statement instead. See the example in the article "Overlay categories on a histogram."

PGStats
Opal | Level 21

Here is an example based on a SASHELP dataset which you may adapt:

 

proc sgplot data=sashelp.citiwk;
band x=date lower=9.5 upper=10.5 / fill;
series x=date y=wspca;
xaxis type=time valuesformat=yyweeku6.;
run;
PG

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
  • 4 replies
  • 1714 views
  • 0 likes
  • 4 in conversation