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

Data (all included) has six unique values for TRT01PN, but only displaying 4 different groups in scatterplot/seriesplot and 4 different classes in blockplot.  In addition, groups 5 (RED) and 6 (ORANGE) are displayed as though they are part of groups 2 and 3 respectively.  Attached is RTF file.

 


Here is a portion of the program-- note that GraphData1 and GraphData4 are designed to have the same color (specified) but different line pattern (by default) and similar (not same) symbol (same idea for GraphData2, GraphData5 as well as GraphData3, GraphData6):

 

proc format;
   value days
      2='Day 1'
      3='Day 7'
      4='Day 14'
      5='Day 30'
      6='Day 60'
      7='Day 90'
      8='Day 120'
   ;

 

 

data WORK.THREE;
  infile datalines dsd truncover;
  input PARAMCD:$15. TRT01PN:32. AVISITN:32. N:32. MEAN:32. LCLM:32. UCLM:32. N_C:$8. AVISITN_STAGGER:32.;
  label PARAMCD="Parameter Code" TRT01PN="Planned Treatment for Period 01 (N) - DB" AVISITN="Analysis Visit (N)" N="Analysis Value" MEAN="Analysis Value" LCLM="Analysis Value" UCLM="Analysis Value";
datalines;
ANLFFOSM 1 3 46 20.065217391 18.677407041 21.453027741 46 2.9
ANLFFOSM 2 3 49 15.632653061 14.213710332 17.051595791 49 2.94
ANLFFOSM 3 3 42 13.833333333 12.443262863 15.223403803 42 2.98
ANLFFESM 4 3 46 15.891304348 14.638839744 17.143768952 46 3.02
ANLFFESM 5 3 49 12.489795918 11.427739722 13.551852115 49 3.06
ANLFFESM 6 3 42 10.142857143 9.3444442823 10.941270003 42 3.1
ANLFFOSM 1 4 50 21.06 19.651938744 22.468061256 50 3.9
ANLFFOSM 2 4 54 13.703703704 12.303250583 15.104156824 54 3.94
ANLFFOSM 3 4 51 11.666666667 10.372080845 12.961252489 51 3.98
ANLFFESM 4 4 50 16.84 15.628309145 18.051690855 50 4.02
ANLFFESM 5 4 54 11.388888889 10.296562736 12.481215042 54 4.06
ANLFFESM 6 4 51 9.4509803922 8.582611908 10.319348876 51 4.1
ANLFFOSM 1 5 50 20.8 19.044333463 22.555666537 50 4.9
ANLFFOSM 2 5 53 14.660377358 13.008390429 16.312364288 53 4.94
ANLFFOSM 3 5 53 12.018867925 10.790361235 13.247374615 53 4.98
ANLFFESM 4 5 50 17.2 15.816037596 18.583962404 50 5.02
ANLFFESM 5 5 53 12.056603774 10.759911407 13.35329614 53 5.06
ANLFFESM 6 5 53 9.3773584906 8.4438476123 10.310869369 53 5.1
ANLFFOSM 1 6 46 20.608695652 18.924764512 22.292626793 46 5.9
ANLFFOSM 2 6 50 15.54 13.761748945 17.318251055 50 5.94
ANLFFOSM 3 6 51 13.450980392 11.975196587 14.926764197 51 5.98
ANLFFESM 4 6 46 17.456521739 16.027930134 18.885113345 46 6.02
ANLFFESM 5 6 50 12.74 11.329132021 14.150867979 50 6.06
ANLFFESM 6 6 51 10.392156863 9.2461304986 11.538183227 51 6.1
ANLFFOSM 1 7 48 21.354166667 19.743025652 22.965307681 48 6.9
ANLFFOSM 2 7 53 17.20754717 15.392544162 19.022550178 53 6.94
ANLFFOSM 3 7 52 15.269230769 13.896333102 16.642128436 52 6.98
ANLFFESM 4 7 48 17.625 16.282113044 18.967886956 48 7.02
ANLFFESM 5 7 53 13.716981132 12.281302995 15.152659269 53 7.06
ANLFFESM 6 7 52 11.307692308 10.166400192 12.448984424 52 7.1
ANLFFOSM 1 8 47 21.893617021 20.280516779 23.506717263 47 7.9
ANLFFOSM 2 8 50 17.98 16.243696237 19.716303763 50 7.94
ANLFFOSM 3 8 49 16.387755102 14.865805435 17.909704769 49 7.98
ANLFFESM 4 8 47 17.659574468 16.273901768 19.045247168 47 8.02
ANLFFESM 5 8 50 14 12.518255442 15.481744558 50 8.06
ANLFFESM 6 8 49 12.06122449 10.82800298 13.294445999 49 8.1
;;;;
run; 

proc format;

   value blocktreat
      1='Treatment Outcome: Placebo'
      2='Low Dose'
      3='High Dose'
      4='Treatment Experience: Placebo'
      5='Low Dose'
      6='High Dose'
   ;

run;

   *** TEMPLATE FOR BUILDING FIGURE ***;
   proc template;
      define style fstylertf1;
         parent = fstylertf;
         *** COLORS/SYMBOLS FOR FIGURE ***;
         class GraphData1 /            markersymbol='circle'            contrastcolor=bib;
         class GraphData2 /            markersymbol='square'            contrastcolor=red;
         class GraphData3 /            markersymbol='triangle'            contrastcolor=orange;
         class GraphData4 /            markersymbol='circlefilled'            contrastcolor=bib;
         class GraphData5 /            markersymbol='squarefilled'            contrastcolor=red;
         class GraphData6 /            markersymbol='trianglefilled'            contrastcolor=orange;
      end;
   run;

   proc template;
      define statgraph rateplot;
         *** LANDSCAPE FORMAT ***;
         begingraph /designwidth=9in designheight=4.3in;
            legenditem type=marker name="outcome" /               markerattrs=(color=white symbol=square)               label="Treatment Outcome:";
            legenditem type=markerline name="placebo1" /         lineattrs=(color=bib pattern=1) markerattrs=(color=bib symbol=circle)               label="Placebo";
            legenditem type=markerline name="low2" /               lineattrs=(color=red pattern=2) markerattrs=(color=red symbol=square)               label="Low Dose";
            legenditem type=markerline name="high3" /   lineattrs=(color=orange pattern=3) markerattrs=(color=orange symbol=triangle)               label="High Dose";
            legenditem type=marker name="experience" /               markerattrs=(color=white symbol=square)               label="Treatment Experience:";
            legenditem type=markerline name="placebo4" /      lineattrs=(color=bib pattern=4) markerattrs=(color=bib symbol=circlefilled)               label="Placebo";
            legenditem type=markerline name="low5" /    lineattrs=(color=red pattern=5) markerattrs=(color=red symbol=squarefilled)               label="Low Dose";
            legenditem type=markerline name="high6" / lineattrs=(color=orange pattern=6) markerattrs=(color=orange symbol=trianglefilled)     label="High Dose";
            *** CODE FOR Y-AXIS LABEL IF PROVIDED ***;
            layout overlay /
               xaxisopts=(label='Visit'                  linearopts=(  tickvaluelist=( 3 4 5 6 7 8            )               )
               yaxisopts=( display=(line ticks tickvalues)  linearopts=(viewmin=4.8 viewmax=30.2     tickvaluesequence=(start=5 end=30 increment=5)      )       )

               ;
               *** PLOT MEANS ***;
               seriesplot y=mean x=avisitn_stagger / group=trt01pn;
               *** PLOT CIs ***;
               scatterplot x=avisitn_stagger y=mean /                  group=trt01pn yerrorupper=uclm yerrorlower=lclm               ;
               *** Ns ***;
               innermargin / align=bottom;
                  blockplot x=avisitn block=n_c / class=trt01pn                     repeatedvalues=true display=(label values)                     extendblockonmissing=true
                     valuehalign=start valuefitpolicy=truncate labelposition=left labelattrs=GRAPHVALUETEXT (size=9pt)
                     valueattrs=GRAPHDATATEXT (size=8pt) includemissingclass=true; ***false;
               endinnermargin;
               *** LEGEND ***;
               discretelegend  "outcome" "placebo1" "low2" "high3" "experience" "placebo4" "low5" "high6"
                  / location=inside across=4 autoalign=(topright bottomright) halign=left;
            endlayout;
         endgraph;
      end;
   run;

   proc sgrender template=rateplot data=three;
      format avisitn_stagger avisitn days. TRT01PN blocktreat.;
   run;

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
djrisks
Barite | Level 11

@Popcornasaurus try this example. It's best to basically create 6 distinct treatment groups because before you only used 4 distinct treatment groups. Also you need to use Discrete Attribute Maps to get the colours of the lines and symbols correct and matching up with the legend: The treatment values on the Y-axis have changed. You can probability get around that another way, perhaps by using the AXISTABLE instead of Blockplot. But I think this example suffices.

 

data WORK.THREE;
infile datalines dsd truncover;
input PARAMCD $ 1-8 TRT01PN 9-10 AVISITN 11-12 N 13-15 MEAN 16-28 LCLM 29-41 UCLM 42-54 N_C 55-57 AVISITN_STAGGER 58-62;
label PARAMCD="Parameter Code" TRT01PN="Planned Treatment for Period 01 (N) - DB" AVISITN="Analysis Visit (N)" N="Analysis Value" MEAN="Analysis Value" LCLM="Analysis Value" UCLM="Analysis Value";
datalines;
ANLFFOSM 1 3 46 20.065217391 18.677407041 21.453027741 46 2.9
ANLFFOSM 2 3 49 15.632653061 14.213710332 17.051595791 49 2.94
ANLFFOSM 3 3 42 13.833333333 12.443262863 15.223403803 42 2.98
ANLFFESM 4 3 46 15.891304348 14.638839744 17.143768952 46 3.02
ANLFFESM 5 3 49 12.489795918 11.427739722 13.551852115 49 3.06
ANLFFESM 6 3 42 10.142857143 9.3444442823 10.941270003 42 3.1
ANLFFOSM 1 4 50 21.06 19.651938744 22.468061256 50 3.9
ANLFFOSM 2 4 54 13.703703704 12.303250583 15.104156824 54 3.94
ANLFFOSM 3 4 51 11.666666667 10.372080845 12.961252489 51 3.98
ANLFFESM 4 4 50 16.84 15.628309145 18.051690855 50 4.02
ANLFFESM 5 4 54 11.388888889 10.296562736 12.481215042 54 4.06
ANLFFESM 6 4 51 9.4509803922 8.582611908 10.319348876 51 4.1
ANLFFOSM 1 5 50 20.8 19.044333463 22.555666537 50 4.9
ANLFFOSM 2 5 53 14.660377358 13.008390429 16.312364288 53 4.94
ANLFFOSM 3 5 53 12.018867925 10.790361235 13.247374615 53 4.98
ANLFFESM 4 5 50 17.2 15.816037596 18.583962404 50 5.02
ANLFFESM 5 5 53 12.056603774 10.759911407 13.35329614 53 5.06
ANLFFESM 6 5 53 9.3773584906 8.4438476123 10.310869369 53 5.1
ANLFFOSM 1 6 46 20.608695652 18.924764512 22.292626793 46 5.9
ANLFFOSM 2 6 50 15.54 13.761748945 17.318251055 50 5.94
ANLFFOSM 3 6 51 13.450980392 11.975196587 14.926764197 51 5.98
ANLFFESM 4 6 46 17.456521739 16.027930134 18.885113345 46 6.02
ANLFFESM 5 6 50 12.74 11.329132021 14.150867979 50 6.06
ANLFFESM 6 6 51 10.392156863 9.2461304986 11.538183227 51 6.1
ANLFFOSM 1 7 48 21.354166667 19.743025652 22.965307681 48 6.9
ANLFFOSM 2 7 53 17.20754717 15.392544162 19.022550178 53 6.94
ANLFFOSM 3 7 52 15.269230769 13.896333102 16.642128436 52 6.98
ANLFFESM 4 7 48 17.625 16.282113044 18.967886956 48 7.02
ANLFFESM 5 7 53 13.716981132 12.281302995 15.152659269 53 7.06
ANLFFESM 6 7 52 11.307692308 10.166400192 12.448984424 52 7.1
ANLFFOSM 1 8 47 21.893617021 20.280516779 23.506717263 47 7.9
ANLFFOSM 2 8 50 17.98 16.243696237 19.716303763 50 7.94
ANLFFOSM 3 8 49 16.387755102 14.865805435 17.909704769 49 7.98
ANLFFESM 4 8 47 17.659574468 16.273901768 19.045247168 47 8.02
ANLFFESM 5 8 50 14 12.518255442 15.481744558 50 8.06
ANLFFESM 6 8 49 12.06122449 10.82800298 13.294445999 49 8.1
;;;;
run;

 

 

 

proc format;
value days
2='Day 1'
3='Day 7'
4='Day 14'
5='Day 30'
6='Day 60'
7='Day 90'
8='Day 120'
;

value blocktreat
1='Treatment Outcome: Placebo'
2='Low Dose Outcome'
3='High Dose Outcome'
4='Treatment Experience: Placebo'
5='Low Dose Experience'
6='High Dose Experience'
;

run;

*** TEMPLATE FOR BUILDING FIGURE ***;
proc template;
define style fstylertf1;
parent = fstylertf;
*** COLORS/SYMBOLS FOR FIGURE ***;
class GraphData1 / markersymbol='circle' contrastcolor=bib;
class GraphData2 / markersymbol='square' contrastcolor=red;
class GraphData3 / markersymbol='triangle' contrastcolor=orange;
class GraphData4 / markersymbol='circlefilled' contrastcolor=bib;
class GraphData5 / markersymbol='squarefilled' contrastcolor=red;
class GraphData6 / markersymbol='trianglefilled' contrastcolor=orange;
end;
run;

proc template;
define statgraph rateplot;
*** LANDSCAPE FORMAT ***;
begingraph /designwidth=9in designheight=4.3in;

DiscreteAttrMap name="Dose_Group";
Value "Treatment Outcome: Placebo" / lineattrs=(color=bib pattern=1) markerattrs=(color=bib symbol=circle);
Value "Low Dose Outcome" / lineattrs=(color=red pattern=2) markerattrs=(color=red symbol=square);
Value "High Dose Outcome" / lineattrs=(color=orange pattern=3) markerattrs=(color=orange symbol=triangle);
Value "Treatment Experience: Placebo" / lineattrs=(color=bib pattern=4) markerattrs=(color=bib symbol=circlefilled);
Value "Low Dose Experience" / lineattrs=(color=red pattern=5) markerattrs=(color=red symbol=squarefilled);
Value "High Dose Experience" / lineattrs=(color=orange pattern=6) markerattrs=(color=orange symbol=trianglefilled);
EndDiscreteAttrMap;
DiscreteAttrVar attrvar = id_dose_group var = trt01pn attrmap = "Dose_Group";

legenditem type=marker name="outcome" / markerattrs=(color=white symbol=square) label="Treatment Outcome:";
legenditem type=markerline name="placebo1" / lineattrs=(color=bib pattern=1) markerattrs=(color=bib symbol=circle) label="Placebo";
legenditem type=markerline name="low2" / lineattrs=(color=red pattern=2) markerattrs=(color=red symbol=square) label="Low Dose";
legenditem type=markerline name="high3" / lineattrs=(color=orange pattern=3) markerattrs=(color=orange symbol=triangle) label="High Dose";
legenditem type=marker name="experience" / markerattrs=(color=white symbol=square) label="Treatment Experience:";
legenditem type=markerline name="placebo4" / lineattrs=(color=bib pattern=4) markerattrs=(color=bib symbol=circlefilled) label="Placebo";
legenditem type=markerline name="low5" / lineattrs=(color=red pattern=5) markerattrs=(color=red symbol=squarefilled) label="Low Dose";
legenditem type=markerline name="high6" / lineattrs=(color=orange pattern=6) markerattrs=(color=orange symbol=trianglefilled) label="High Dose";
*** CODE FOR Y-AXIS LABEL IF PROVIDED ***;
layout overlay /
xaxisopts=(label='Visit' linearopts=(tickvaluelist=(3 4 5 6 7 8)))
yaxisopts=( display=(line ticks tickvalues) linearopts=(viewmin=4.8 viewmax=30.2 tickvaluesequence=(start=5 end=30 increment=5) ) )

;
*** PLOT MEANS ***;
seriesplot y=mean x=avisitn_stagger / group= id_dose_group;
*** PLOT CIs ***;
scatterplot x=avisitn_stagger y=mean / group= id_dose_group yerrorupper=uclm yerrorlower=lclm ;
*** Ns ***;
innermargin / align=bottom;
blockplot x=avisitn block=n_c / class=id_dose_group repeatedvalues=true display=(label values) extendblockonmissing=true
valuehalign=start valuefitpolicy=truncate labelposition=left labelattrs=GRAPHVALUETEXT (size=9pt)
valueattrs=GRAPHDATATEXT (size=8pt) includemissingclass=true; ***false;
endinnermargin;
*** LEGEND ***;
discretelegend "outcome" "placebo1" "low2" "high3" "experience" "placebo4" "low5" "high6"
/ location=inside across=4 autoalign=(topright bottomright) halign=left;
endlayout;
endgraph;
end;
run;

proc sgrender template=rateplot data=three;
format avisitn_stagger avisitn days. TRT01PN blocktreat.;
run;

proc freq data = three;
tables trt01pn;
run;

View solution in original post

7 REPLIES 7
ballardw
Super User

Please provide data in the form of data step code. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.

 

Also it is a good idea to post ANY code in a code box.

The bit that your code as posted includes this line:

               xaxisopts=(label='Visit'                  linearopts=(  tickvaluelist=( 3 4 5 6 7

ballardw_0-1603906878416.png

 

                  )               )

likely means that you have an issue with something in the tickvaluelist that is getting interpreted by the forum as intended to be an emoji and likely needs some correction.

 

In your PROC SGRENDER you need a DYNAMIC statement to link a data step variable to the dynamic variable &trt in your code.

Popcornasaurus
Calcite | Level 5
Thanks for the pointers on posting; I am a rookie poster. How does the posting look now?
djrisks
Barite | Level 11

Hi @Popcornasaurus

 

Can you please include the Days format too?

 

Thanks,

 

Kriss 

djrisks
Barite | Level 11

@Popcornasaurus I'm also unable to create the work dataset THREE, using the current code.

 

Many thanks,

 

Kriss 

Popcornasaurus
Calcite | Level 5
text about code removed that was in code section has been removed
djrisks
Barite | Level 11

@Popcornasaurus try this example. It's best to basically create 6 distinct treatment groups because before you only used 4 distinct treatment groups. Also you need to use Discrete Attribute Maps to get the colours of the lines and symbols correct and matching up with the legend: The treatment values on the Y-axis have changed. You can probability get around that another way, perhaps by using the AXISTABLE instead of Blockplot. But I think this example suffices.

 

data WORK.THREE;
infile datalines dsd truncover;
input PARAMCD $ 1-8 TRT01PN 9-10 AVISITN 11-12 N 13-15 MEAN 16-28 LCLM 29-41 UCLM 42-54 N_C 55-57 AVISITN_STAGGER 58-62;
label PARAMCD="Parameter Code" TRT01PN="Planned Treatment for Period 01 (N) - DB" AVISITN="Analysis Visit (N)" N="Analysis Value" MEAN="Analysis Value" LCLM="Analysis Value" UCLM="Analysis Value";
datalines;
ANLFFOSM 1 3 46 20.065217391 18.677407041 21.453027741 46 2.9
ANLFFOSM 2 3 49 15.632653061 14.213710332 17.051595791 49 2.94
ANLFFOSM 3 3 42 13.833333333 12.443262863 15.223403803 42 2.98
ANLFFESM 4 3 46 15.891304348 14.638839744 17.143768952 46 3.02
ANLFFESM 5 3 49 12.489795918 11.427739722 13.551852115 49 3.06
ANLFFESM 6 3 42 10.142857143 9.3444442823 10.941270003 42 3.1
ANLFFOSM 1 4 50 21.06 19.651938744 22.468061256 50 3.9
ANLFFOSM 2 4 54 13.703703704 12.303250583 15.104156824 54 3.94
ANLFFOSM 3 4 51 11.666666667 10.372080845 12.961252489 51 3.98
ANLFFESM 4 4 50 16.84 15.628309145 18.051690855 50 4.02
ANLFFESM 5 4 54 11.388888889 10.296562736 12.481215042 54 4.06
ANLFFESM 6 4 51 9.4509803922 8.582611908 10.319348876 51 4.1
ANLFFOSM 1 5 50 20.8 19.044333463 22.555666537 50 4.9
ANLFFOSM 2 5 53 14.660377358 13.008390429 16.312364288 53 4.94
ANLFFOSM 3 5 53 12.018867925 10.790361235 13.247374615 53 4.98
ANLFFESM 4 5 50 17.2 15.816037596 18.583962404 50 5.02
ANLFFESM 5 5 53 12.056603774 10.759911407 13.35329614 53 5.06
ANLFFESM 6 5 53 9.3773584906 8.4438476123 10.310869369 53 5.1
ANLFFOSM 1 6 46 20.608695652 18.924764512 22.292626793 46 5.9
ANLFFOSM 2 6 50 15.54 13.761748945 17.318251055 50 5.94
ANLFFOSM 3 6 51 13.450980392 11.975196587 14.926764197 51 5.98
ANLFFESM 4 6 46 17.456521739 16.027930134 18.885113345 46 6.02
ANLFFESM 5 6 50 12.74 11.329132021 14.150867979 50 6.06
ANLFFESM 6 6 51 10.392156863 9.2461304986 11.538183227 51 6.1
ANLFFOSM 1 7 48 21.354166667 19.743025652 22.965307681 48 6.9
ANLFFOSM 2 7 53 17.20754717 15.392544162 19.022550178 53 6.94
ANLFFOSM 3 7 52 15.269230769 13.896333102 16.642128436 52 6.98
ANLFFESM 4 7 48 17.625 16.282113044 18.967886956 48 7.02
ANLFFESM 5 7 53 13.716981132 12.281302995 15.152659269 53 7.06
ANLFFESM 6 7 52 11.307692308 10.166400192 12.448984424 52 7.1
ANLFFOSM 1 8 47 21.893617021 20.280516779 23.506717263 47 7.9
ANLFFOSM 2 8 50 17.98 16.243696237 19.716303763 50 7.94
ANLFFOSM 3 8 49 16.387755102 14.865805435 17.909704769 49 7.98
ANLFFESM 4 8 47 17.659574468 16.273901768 19.045247168 47 8.02
ANLFFESM 5 8 50 14 12.518255442 15.481744558 50 8.06
ANLFFESM 6 8 49 12.06122449 10.82800298 13.294445999 49 8.1
;;;;
run;

 

 

 

proc format;
value days
2='Day 1'
3='Day 7'
4='Day 14'
5='Day 30'
6='Day 60'
7='Day 90'
8='Day 120'
;

value blocktreat
1='Treatment Outcome: Placebo'
2='Low Dose Outcome'
3='High Dose Outcome'
4='Treatment Experience: Placebo'
5='Low Dose Experience'
6='High Dose Experience'
;

run;

*** TEMPLATE FOR BUILDING FIGURE ***;
proc template;
define style fstylertf1;
parent = fstylertf;
*** COLORS/SYMBOLS FOR FIGURE ***;
class GraphData1 / markersymbol='circle' contrastcolor=bib;
class GraphData2 / markersymbol='square' contrastcolor=red;
class GraphData3 / markersymbol='triangle' contrastcolor=orange;
class GraphData4 / markersymbol='circlefilled' contrastcolor=bib;
class GraphData5 / markersymbol='squarefilled' contrastcolor=red;
class GraphData6 / markersymbol='trianglefilled' contrastcolor=orange;
end;
run;

proc template;
define statgraph rateplot;
*** LANDSCAPE FORMAT ***;
begingraph /designwidth=9in designheight=4.3in;

DiscreteAttrMap name="Dose_Group";
Value "Treatment Outcome: Placebo" / lineattrs=(color=bib pattern=1) markerattrs=(color=bib symbol=circle);
Value "Low Dose Outcome" / lineattrs=(color=red pattern=2) markerattrs=(color=red symbol=square);
Value "High Dose Outcome" / lineattrs=(color=orange pattern=3) markerattrs=(color=orange symbol=triangle);
Value "Treatment Experience: Placebo" / lineattrs=(color=bib pattern=4) markerattrs=(color=bib symbol=circlefilled);
Value "Low Dose Experience" / lineattrs=(color=red pattern=5) markerattrs=(color=red symbol=squarefilled);
Value "High Dose Experience" / lineattrs=(color=orange pattern=6) markerattrs=(color=orange symbol=trianglefilled);
EndDiscreteAttrMap;
DiscreteAttrVar attrvar = id_dose_group var = trt01pn attrmap = "Dose_Group";

legenditem type=marker name="outcome" / markerattrs=(color=white symbol=square) label="Treatment Outcome:";
legenditem type=markerline name="placebo1" / lineattrs=(color=bib pattern=1) markerattrs=(color=bib symbol=circle) label="Placebo";
legenditem type=markerline name="low2" / lineattrs=(color=red pattern=2) markerattrs=(color=red symbol=square) label="Low Dose";
legenditem type=markerline name="high3" / lineattrs=(color=orange pattern=3) markerattrs=(color=orange symbol=triangle) label="High Dose";
legenditem type=marker name="experience" / markerattrs=(color=white symbol=square) label="Treatment Experience:";
legenditem type=markerline name="placebo4" / lineattrs=(color=bib pattern=4) markerattrs=(color=bib symbol=circlefilled) label="Placebo";
legenditem type=markerline name="low5" / lineattrs=(color=red pattern=5) markerattrs=(color=red symbol=squarefilled) label="Low Dose";
legenditem type=markerline name="high6" / lineattrs=(color=orange pattern=6) markerattrs=(color=orange symbol=trianglefilled) label="High Dose";
*** CODE FOR Y-AXIS LABEL IF PROVIDED ***;
layout overlay /
xaxisopts=(label='Visit' linearopts=(tickvaluelist=(3 4 5 6 7 8)))
yaxisopts=( display=(line ticks tickvalues) linearopts=(viewmin=4.8 viewmax=30.2 tickvaluesequence=(start=5 end=30 increment=5) ) )

;
*** PLOT MEANS ***;
seriesplot y=mean x=avisitn_stagger / group= id_dose_group;
*** PLOT CIs ***;
scatterplot x=avisitn_stagger y=mean / group= id_dose_group yerrorupper=uclm yerrorlower=lclm ;
*** Ns ***;
innermargin / align=bottom;
blockplot x=avisitn block=n_c / class=id_dose_group repeatedvalues=true display=(label values) extendblockonmissing=true
valuehalign=start valuefitpolicy=truncate labelposition=left labelattrs=GRAPHVALUETEXT (size=9pt)
valueattrs=GRAPHDATATEXT (size=8pt) includemissingclass=true; ***false;
endinnermargin;
*** LEGEND ***;
discretelegend "outcome" "placebo1" "low2" "high3" "experience" "placebo4" "low5" "high6"
/ location=inside across=4 autoalign=(topright bottomright) halign=left;
endlayout;
endgraph;
end;
run;

proc sgrender template=rateplot data=three;
format avisitn_stagger avisitn days. TRT01PN blocktreat.;
run;

proc freq data = three;
tables trt01pn;
run;

djrisks
Barite | Level 11
data WORK.THREE;
  infile datalines dsd truncover;
  input PARAMCD $ 1-8 TRT01PN 9-10 AVISITN 11-12 N 13-15 MEAN 16-28 LCLM 29-41 UCLM 42-54 N_C 55-57 AVISITN_STAGGER 58-62;
  label PARAMCD="Parameter Code" TRT01PN="Planned Treatment for Period 01 (N) - DB" AVISITN="Analysis Visit (N)" N="Analysis Value" MEAN="Analysis Value" LCLM="Analysis Value" UCLM="Analysis Value";
datalines;
ANLFFOSM 1 3 46 20.065217391 18.677407041 21.453027741 46 2.9
ANLFFOSM 2 3 49 15.632653061 14.213710332 17.051595791 49 2.94
ANLFFOSM 3 3 42 13.833333333 12.443262863 15.223403803 42 2.98
ANLFFESM 4 3 46 15.891304348 14.638839744 17.143768952 46 3.02
ANLFFESM 5 3 49 12.489795918 11.427739722 13.551852115 49 3.06
ANLFFESM 6 3 42 10.142857143 9.3444442823 10.941270003 42 3.1
ANLFFOSM 1 4 50 21.06        19.651938744 22.468061256 50 3.9
ANLFFOSM 2 4 54 13.703703704 12.303250583 15.104156824 54 3.94
ANLFFOSM 3 4 51 11.666666667 10.372080845 12.961252489 51 3.98
ANLFFESM 4 4 50 16.84        15.628309145 18.051690855 50 4.02
ANLFFESM 5 4 54 11.388888889 10.296562736 12.481215042 54 4.06
ANLFFESM 6 4 51 9.4509803922 8.582611908  10.319348876 51 4.1
ANLFFOSM 1 5 50 20.8         19.044333463 22.555666537 50 4.9
ANLFFOSM 2 5 53 14.660377358 13.008390429 16.312364288 53 4.94
ANLFFOSM 3 5 53 12.018867925 10.790361235 13.247374615 53 4.98
ANLFFESM 4 5 50 17.2         15.816037596 18.583962404 50 5.02
ANLFFESM 5 5 53 12.056603774 10.759911407 13.35329614  53 5.06
ANLFFESM 6 5 53 9.3773584906 8.4438476123 10.310869369 53 5.1
ANLFFOSM 1 6 46 20.608695652 18.924764512 22.292626793 46 5.9
ANLFFOSM 2 6 50 15.54        13.761748945 17.318251055 50 5.94
ANLFFOSM 3 6 51 13.450980392 11.975196587 14.926764197 51 5.98
ANLFFESM 4 6 46 17.456521739 16.027930134 18.885113345 46 6.02
ANLFFESM 5 6 50 12.74        11.329132021 14.150867979 50 6.06
ANLFFESM 6 6 51 10.392156863 9.2461304986 11.538183227 51 6.1
ANLFFOSM 1 7 48 21.354166667 19.743025652 22.965307681 48 6.9
ANLFFOSM 2 7 53 17.20754717  15.392544162 19.022550178 53 6.94
ANLFFOSM 3 7 52 15.269230769 13.896333102 16.642128436 52 6.98
ANLFFESM 4 7 48 17.625       16.282113044 18.967886956 48 7.02
ANLFFESM 5 7 53 13.716981132 12.281302995 15.152659269 53 7.06
ANLFFESM 6 7 52 11.307692308 10.166400192 12.448984424 52 7.1
ANLFFOSM 1 8 47 21.893617021 20.280516779 23.506717263 47 7.9
ANLFFOSM 2 8 50 17.98        16.243696237 19.716303763 50 7.94
ANLFFOSM 3 8 49 16.387755102 14.865805435 17.909704769 49 7.98
ANLFFESM 4 8 47 17.659574468 16.273901768 19.045247168 47 8.02
ANLFFESM 5 8 50 14           12.518255442 15.481744558 50 8.06
ANLFFESM 6 8 49 12.06122449  10.82800298  13.294445999 49 8.1
;;;;
run; 




 



proc format;
   value days
      2='Day 1'
      3='Day 7'
      4='Day 14'
      5='Day 30'
      6='Day 60'
      7='Day 90'
      8='Day 120'
   ;

   value blocktreat
      1='Treatment Outcome: Placebo'
      2='Low Dose Outcome'
      3='High Dose Outcome'
      4='Treatment Experience: Placebo'
      5='Low Dose Experience'
      6='High Dose Experience'
   ;

run;

   *** TEMPLATE FOR BUILDING FIGURE ***;
   proc template;
      define style fstylertf1;
         parent = fstylertf;
         *** COLORS/SYMBOLS FOR FIGURE ***;
         class GraphData1 /            markersymbol='circle'            contrastcolor=bib;
         class GraphData2 /            markersymbol='square'            contrastcolor=red;
         class GraphData3 /            markersymbol='triangle'            contrastcolor=orange;
         class GraphData4 /            markersymbol='circlefilled'            contrastcolor=bib;
         class GraphData5 /            markersymbol='squarefilled'            contrastcolor=red;
         class GraphData6 /            markersymbol='trianglefilled'            contrastcolor=orange;
      end;
   run;

   proc template;
      define statgraph rateplot;
         *** LANDSCAPE FORMAT ***;
         begingraph /designwidth=9in designheight=4.3in;

	   DiscreteAttrMap name="Dose_Group";
            Value "Treatment Outcome: Placebo" / lineattrs=(color=bib pattern=1) markerattrs=(color=bib symbol=circle);
            Value "Low Dose Outcome" / lineattrs=(color=red pattern=2) markerattrs=(color=red symbol=square);
            Value "High Dose Outcome" / lineattrs=(color=orange pattern=3) markerattrs=(color=orange symbol=triangle);
            Value "Treatment Experience: Placebo" / lineattrs=(color=bib pattern=4) markerattrs=(color=bib symbol=circlefilled);
			Value "Low Dose Experience" / lineattrs=(color=red pattern=5) markerattrs=(color=red symbol=squarefilled);
            Value "High Dose Experience" / lineattrs=(color=orange pattern=6) markerattrs=(color=orange symbol=trianglefilled);
        EndDiscreteAttrMap;
	    DiscreteAttrVar attrvar = id_dose_group var = trt01pn attrmap = "Dose_Group";

            legenditem type=marker name="outcome" /               markerattrs=(color=white symbol=square)               label="Treatment Outcome:";
            legenditem type=markerline name="placebo1" /         lineattrs=(color=bib pattern=1) markerattrs=(color=bib symbol=circle)               label="Placebo";
            legenditem type=markerline name="low2" /               lineattrs=(color=red pattern=2) markerattrs=(color=red symbol=square)               label="Low Dose";
            legenditem type=markerline name="high3" /   lineattrs=(color=orange pattern=3) markerattrs=(color=orange symbol=triangle)               label="High Dose";
            legenditem type=marker name="experience" /               markerattrs=(color=white symbol=square)               label="Treatment Experience:";
            legenditem type=markerline name="placebo4" /      lineattrs=(color=bib pattern=4) markerattrs=(color=bib symbol=circlefilled)               label="Placebo";
            legenditem type=markerline name="low5" /    lineattrs=(color=red pattern=5) markerattrs=(color=red symbol=squarefilled)               label="Low Dose";
            legenditem type=markerline name="high6" / lineattrs=(color=orange pattern=6) markerattrs=(color=orange symbol=trianglefilled)     label="High Dose";
            *** CODE FOR Y-AXIS LABEL IF PROVIDED ***;
            layout overlay /
               xaxisopts=(label='Visit' linearopts=(tickvaluelist=(3 4 5 6 7 8)))
               yaxisopts=( display=(line ticks tickvalues)  linearopts=(viewmin=4.8 viewmax=30.2     tickvaluesequence=(start=5 end=30 increment=5)      )       )

               ;
               *** PLOT MEANS ***;
               seriesplot y=mean x=avisitn_stagger / group= id_dose_group;
               *** PLOT CIs ***;
               scatterplot x=avisitn_stagger y=mean /                  group= id_dose_group yerrorupper=uclm yerrorlower=lclm               ;
               *** Ns ***;
               innermargin / align=bottom;
                  blockplot x=avisitn block=n_c / class=id_dose_group                     repeatedvalues=true display=(label values)                     extendblockonmissing=true
                     valuehalign=start valuefitpolicy=truncate labelposition=left labelattrs=GRAPHVALUETEXT (size=9pt)
                     valueattrs=GRAPHDATATEXT (size=8pt) includemissingclass=true; ***false;
               endinnermargin;
               *** LEGEND ***;
               discretelegend  "outcome" "placebo1" "low2" "high3" "experience" "placebo4" "low5" "high6"
                  / location=inside across=4 autoalign=(topright bottomright) halign=left;
            endlayout;
         endgraph;
      end;
   run;

   proc sgrender template=rateplot data=three;
      format avisitn_stagger avisitn days. TRT01PN blocktreat.;
   run;

   proc freq data = three;
     tables trt01pn;
   run;

SAS help.png

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
  • 7 replies
  • 619 views
  • 0 likes
  • 3 in conversation