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

Hello,

           I am trying to code a a trend line for multiple districts in one graph. I have used a similar code for the trend line for individual plot and it works. The problem I am trying to add the 'district' variable in the proc x11 state. Right now 'district' is not added to my proc x11 statement. I'd appreciate your insight on how to add the 'district 'variable.

```

proc x11 data = causerie_t_total_mean_all noprint;
monthly additive date = date;
var mean_cough_rate;
tables a1 d12;
output out = test_all_cold a1 = mean_coldcough_rate d12 = adj;run;
title 'Trend line for the proportion of cough, by district';
proc sgplot data=test_all_cold;
series x=date y= adj / group=district markers legendlabel="trend cycle";
xaxis label='Date';
yaxis label='Proportion of cough';
run;

````

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Try two things:

1. add the ID statement to the proc:

    ID district;

2. Make sure that your input data is sorted by the "district" variable.

View solution in original post

4 REPLIES 4
DanH_sas
SAS Super FREQ

If you add the "district" variable to a BY statement in PROC X11, does the output data set contain the calculations per district? If so, you can plot those results in PROC SGPLOT.

 

Hope this helps!

Dan 

pearson101
Calcite | Level 5

Hello, when I type by district, it produced a output for only one of the district. Is it possible to include the district variable in oneput data such that I can  code something like?:

 

proc sgplot data=test_all_cold;
series x=date y= adj / group=district markers legendlabel="trend cycle";run;

DanH_sas
SAS Super FREQ

Try two things:

1. add the ID statement to the proc:

    ID district;

2. Make sure that your input data is sorted by the "district" variable.

pearson101
Calcite | Level 5

Thank you for your help!

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
  • 405 views
  • 1 like
  • 2 in conversation