BookmarkSubscribeRSS Feed
pearson101
Calcite | Level 5

I have a plot of time vs average height. The plot displays by 6 line due to the group (district). How do add a trend line given the group? is it something I have to do prior to plotting?

This is my code:

````

title 'Average height (by district)';
proc sgplot data=height;
series x=date y=mean_height / group=district legendlabel="original" ;
xaxis label='Date';
yaxis label='Average';
run;

```

1 REPLY 1
PaigeMiller
Diamond | Level 26

"trend line" can have any one of several meanings and you do not specify exactly what trend you mean

 

Here's how to obtain one such trend line — add a REG statement into PROC SGPLOT with the GROUP= option. This could possibly create a very cramped and hard to read plot, but I leave that up to you to decide.

--
Paige Miller

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
  • 1421 views
  • 0 likes
  • 2 in conversation