BookmarkSubscribeRSS Feed
pearson101
Calcite | Level 5

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;

```

2 REPLIES 2
Rick_SAS
SAS Super FREQ

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;

 

 

pearson101
Calcite | Level 5

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;

```

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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