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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 4 replies
  • 889 views
  • 0 likes
  • 4 in conversation