Hello,
I am trying to do a sgpanel for a dataset. I am working with three main variables :'district' , 'malaria rate' and 'adjusted trend line'. I used prox 11 for the adjusted trend line. I want create a panel of malaria rate over time by 6 districts.
The encountered a problem with one of my districts called 'N'. The problem is that is there enough data (<36) to create a adjusted trend line. When I tried the following code to create a panel of all my plots (one line for malaria rate and another for trend line), every district shown up except for "N". I am wondering if it is possible to somehow have "N" show up in the panel but just have malaria rate line and not for the trend line (since it's not possible). Your insight will be helpful. Thank you.
````
proc x11 data = causerie_t_total_mean_all noprint;
monthly additive date = date;
by district;
var mean_malaria_rate;
tables a1 d12;
output out = test_all_mal a1 = mean_malaria_rate d12 = adj;run;
proc sgpanel data=test_all_mal;
panelby district / novarname;
rowaxis label='Number of malaria cases per 1000';
vline date / response=mean_malaria_rate;
vline date / response=adj markers markerattrs=(color=blue symbol='circle') lineattrs=(color=blue) legendlabel="trend cycle";
run;
```
I think you can get your results if you have missing values for the mean_malaria_rate for the district='N' group. If they are not already missing, use a separate data step to force the values to missing, like this:
data test_all2;
set test_all_mal;
if district='N' then mean_maleria_rate=.;
run;
Here is an example that has missing values for the mean_malaria_rate. See if it gives you what you want:
data test_all_mal;
input district $ date mean_malaria_rate adj;
datalines;
A 1 0 0
A 2 2 1
A 3 4 3
A 4 6 7
B 1 1 2
B 2 2 1
B 3 3 3
B 4 4 .
N 1 . 3
N 2 . 4
N 3 . 4
N 4 . 4
;
proc sgpanel data=test_all_mal;
panelby district / novarname;
rowaxis label='Number of malaria cases per 1000';
vline date / response=mean_malaria_rate;
vline date / response=adj markers markerattrs=(color=blue symbol='circle') lineattrs=(color=blue) legendlabel="trend cycle";
run;
Hello,
I am trying to do a sgpanel for a dataset. I am working with three main variables :'district' , 'malaria rate' and 'adjusted trend line'. I used prox 11 for the adjusted trend line. I want create a panel of malaria rate over time by 6 districts.
The encountered a problem with one of my districts called 'N'. The problem is that is there enough data (<36) to create a adjusted trend line. When I tried the following code to create a panel of all my plots (one line for malaria rate and another for trend line), every district shown up except for "N". I am wondering if it is possible to somehow have "N" show up in the panel but just have malaria rate line and not for the trend line (since it's not possible). Your insight will be helpful. Thank you.
````
proc x11 data = causerie_t_total_mean_all noprint;
monthly additive date = date;
by district;
var mean_malaria_rate;
tables a1 d12;
output out = test_all_mal a1 = mean_malaria_rate d12 = adj;run;
proc sgpanel data=test_all_mal;
panelby district / novarname;
rowaxis label='Number of malaria cases per 1000';
vline date / response=mean_malaria_rate;
vline date / response=adj markers markerattrs=(color=blue symbol='circle') lineattrs=(color=blue) legendlabel="trend cycle";
run;
```
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!
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.