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

Folks -

 

Thought I had correct code to create polygon (see AREABAR section of code), but the first hour does not plot.  Looking at the AREABAR data shows

 

    I
X D Y

0 1 0.0000
0 1 75.8477
0 1 75.8477
0 1 0.0000
0 2 0.0000
0 2 55.9871

 

Note the six occurences for the first x (hour). The rest of the graph looks good.  Please see the attached pdf output, sas source and DATA=WORKAREA data.  New with polygons, so bear with me.

 

Thanks for any help!

 

Mark

1 ACCEPTED SOLUTION

Accepted Solutions
MarkHiltbruner
Fluorite | Level 6

Folks -

 

This code fixed my problem -

 

DATA AREABAR;
SET cpudata2;
RETAIN id 0 ;
id=id+1; y=0; x=hour-.5; output;
y=lpctby; x=hour-.5; output;
y=lpctby; x=hour+.5; output;
y=0; x=hour+.5; output;
run;

 

i finally figured out that I needed to calculate the width of the hour variable. 

 

Closing issue.  Thanks for all of the help.

 

MH

View solution in original post

3 REPLIES 3
Rick_SAS
SAS Super FREQ

I've moved your question to the Graphics Community.

 

Because you did not provide a cut-and-paste example, I do not have time to try to test my idea, but I suggest you try adding VALUESHINT to the XAXIS statement. It might solve the problem, and it won't hurt.

 

xaxis offsetmin=.02 label='Hour of Day' values= (0 to 23 by 1) VALUESHINT;

ballardw
Super User

@MarkHiltbruner wrote:

Folks -

 

Thought I had correct code to create polygon (see AREABAR section of code), but the first hour does not plot.  Looking at the AREABAR data shows

 

    I
X D Y

0 1 0.0000
0 1 75.8477
0 1 75.8477
0 1 0.0000
0 2 0.0000
0 2 55.9871

 

Note the six occurences for the first x (hour). The rest of the graph looks good.  Please see the attached pdf output, sas source and DATA=WORKAREA data.  New with polygons, so bear with me.

 

Thanks for any help!

 

Mark


Same comment as last time: you don't have enough vertices. All of your X values are the same so all that could be attempted would be a vertical up and down line section as Y changes.

 

To plot Id=1 values I would expect the dat ato look something like:

0 1 0.0000
0 1 75.8477
4 1 75.8477
4 1 0.0000

If you have a datetime that starts at midnight consider what hour is involved. After a time of 23:59:59 when you add one second you get a time value of 00:00:00. So you are not getting a useable X increment for Hour=0.

So this data step:

DATA AREABAR;
  SET cpudata2;
  RETAIN x 0 id 0 ;
  id=id+1; y=0; output;
  y=lpctby; output;
  x=hour; output;
  y=0; output;
run;

needs some adjustment to handle hour 0.

MarkHiltbruner
Fluorite | Level 6

Folks -

 

This code fixed my problem -

 

DATA AREABAR;
SET cpudata2;
RETAIN id 0 ;
id=id+1; y=0; x=hour-.5; output;
y=lpctby; x=hour-.5; output;
y=lpctby; x=hour+.5; output;
y=0; x=hour+.5; output;
run;

 

i finally figured out that I needed to calculate the width of the hour variable. 

 

Closing issue.  Thanks for all of the help.

 

MH

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1069 views
  • 2 likes
  • 3 in conversation