BookmarkSubscribeRSS Feed
riyaaora275
Obsidian | Level 7

riyaaora275_0-1612461420276.png

The class variable has 1 and 2 in front of it , how do i remove it?

 

proc template ;
define statgraph Stat.Lifetest.Graphics.ProductLimitSurvival2;
   dynamic NStrata xName plotAtRisk plotCensored plotCL plotHW plotEP labelCL labelHW labelEP maxTime xtickVals xtickValFitPol
      rowWeights method StratumID classAtRisk plotTest GroupName Transparency SecondTitle TestName pValue _byline_ _bytitle_
      _byfootnote_;
   BeginGraph;
      if (NSTRATA=1)
         if (EXISTS(STRATUMID))
            entrytitle &titletext1;
         else
            entrytitle &titletext0;
         endif;
         entrytitle "xyz2" / textattrs=GRAPHVALUETEXT;
         layout lattice / rows=2 rowweights=ROWWEIGHTS columndatarange=union rowgutter=10;
            cell;
               layout overlay / xaxisopts=(shortlabel=XNAME offsetmin=0 linearopts=(viewmax=MAXTIME tickvaluelist=XTICKVALS 
                  tickvaluefitpolicy=XTICKVALFITPOL)) yaxisopts=(label="&yaxis" shortlabel="Survival" offsetmin=0 linearopts=(
                  viewmin=0 viewmax=1 tickvaluelist=(0 .2 .4 .6 .8 1.0)));
                  if (PLOTHW=1 AND PLOTEP=0)
                     bandplot LimitUpper=HW_UCL LimitLower=HW_LCL x=TIME / displayTail=false modelname="Survival" fillattrs=
                        GRAPHCONFIDENCE name="HW" legendlabel=LABELHW;
                  endif;
                  if (PLOTHW=0 AND PLOTEP=1)
                     bandplot LimitUpper=EP_UCL LimitLower=EP_LCL x=TIME / displayTail=false modelname="Survival" fillattrs=
                        GRAPHCONFIDENCE name="EP" legendlabel=LABELEP;
                  endif;
                  if (PLOTHW=1 AND PLOTEP=1)
                     bandplot LimitUpper=HW_UCL LimitLower=HW_LCL x=TIME / displayTail=false modelname="Survival" fillattrs=
                        GRAPHDATA1 datatransparency=.55 name="HW" legendlabel=LABELHW;
                     bandplot LimitUpper=EP_UCL LimitLower=EP_LCL x=TIME / displayTail=false modelname="Survival" fillattrs=
                        GRAPHDATA2 datatransparency=.55 name="EP" legendlabel=LABELEP;

 

                  endif;
                  if (PLOTCL=1)
                     if (PLOTHW=1 OR PLOTEP=1)
                        bandplot LimitUpper=SDF_UCL LimitLower=SDF_LCL x=TIME / displayTail=false modelname="Survival" display=(
                           outline) outlineattrs=GRAPHPREDICTIONLIMITS name="CL" legendlabel=LABELCL;
                     else
                        bandplot LimitUpper=SDF_UCL LimitLower=SDF_LCL x=TIME / displayTail=false modelname="Survival" fillattrs=
                           GRAPHCONFIDENCE name="CL" legendlabel=LABELCL;
                     endif;
                  endif;
                  stepplot y=SURVIVAL x=TIME / name="Survival" rolename=(_tip1=ATRISK _tip2=EVENT) tiplabel=(_tip1="Number at Risk"
                     _tip2="Observed Events") tip=(x y _tip1 _tip2) legendlabel="Survival";

                  if (PLOTCENSORED=1)
                     scatterplot y=CENSORED x=TIME / markerattrs=(symbol=plus) tiplabel=(y="Survival Probability") name="Censored"
                        legendlabel="Censored";
                  endif;
                  if (PLOTCL=1 OR PLOTHW=1 OR PLOTEP=1)
                     discretelegend "Censored" "CL" "HW" "EP" / location=outside halign=center;
                  else
                     if (PLOTCENSORED=1)
                        discretelegend "Censored" / location=inside autoalign=(topright bottomleft);
                     endif;
                  endif;
               endlayout;
            endcell;
            cell;
               layout overlay / walldisplay=none xaxisopts=(display=none);
                  axistable x=TATRISK value=ATRISK / display=(label) valueattrs=(size=7pt);
				   drawtext  'Number at Risk' / x=3 y=20 width=9;
               endlayout;
            endcell;
         endlayout;
      else
         entrytitle &titletext1;
         if (EXISTS(SECONDTITLE))
            entrytitle SECONDTITLE / textattrs=GRAPHVALUETEXT;
         endif;
         layout lattice / rows=2 rowweights=ROWWEIGHTS columndatarange=union rowgutter=10;
            cell;
               layout overlay / xaxisopts=(shortlabel=XNAME offsetmin=0 linearopts=(viewmax=MAXTIME tickvaluelist=XTICKVALS 
                  tickvaluefitpolicy=XTICKVALFITPOL)) yaxisopts=(label="&yaxis." shortlabel="Survival" offsetmin=0 linearopts=(
                  viewmin=0 viewmax=1 tickvaluelist=(0 .2 .4 .6 .8 1.0)));
                  if (PLOTHW=1)
                     bandplot LimitUpper=HW_UCL LimitLower=HW_LCL x=TIME / displayTail=false group=STRATUM index=STRATUMNUM
                        modelname="Survival" datatransparency=Transparency;
                  endif;
                  if (PLOTEP=1)
                     bandplot LimitUpper=EP_UCL LimitLower=EP_LCL x=TIME / displayTail=false group=STRATUM index=STRATUMNUM
                        modelname="Survival" datatransparency=Transparency;
                  endif;
                  if (PLOTCL=1)
                     if (PLOTHW=1 OR PLOTEP=1)
                        bandplot LimitUpper=SDF_UCL LimitLower=SDF_LCL x=TIME / displayTail=false group=STRATUM index=STRATUMNUM
                           modelname="Survival" display=(outline) outlineattrs=(pattern=ShortDash);
                     else
                        bandplot LimitUpper=SDF_UCL LimitLower=SDF_LCL x=TIME / displayTail=false group=STRATUM index=STRATUMNUM
                           modelname="Survival" datatransparency=Transparency;
                     endif;
                  endif;

 

                  stepplot y=SURVIVAL x=TIME / group=STRATUM index=STRATUMNUM name="Survival" rolename=(_tip1=ATRISK _tip2=EVENT)
                     tiplabel=(_tip1="Number at Risk" _tip2="Observed Events") tip=(x y _tip1 _tip2);
                  if (PLOTCENSORED=1)
                     scatterplot y=CENSORED x=TIME / group=STRATUM index=STRATUMNUM tiplabel=(y="Survival Probability") markerattrs
                        =(symbol=plus);
                  endif;
                  DiscreteLegend "Survival" / title=GROUPNAME location=outside ;
                  if (PLOTCENSORED=1)
                     if (PLOTTEST=1)
                        layout gridded / rows=2 autoalign=(TOPRIGHT ) border=false BackgroundColor=
                           GraphWalls:Color Opaque=true;
                           entry "+ Censored";
                           if (PVALUE < .0001)
                              entry TESTNAME " p " eval (PUT(PVALUE, PVALUE6.4));
                           else
                              entry TESTNAME " p=" eval (PUT(PVALUE, PVALUE6.4));
                           endif;
                        endlayout;
                     else
                        layout gridded / rows=1 autoalign=(TOPRIGHT ) border=false BackgroundColor=
                           GraphWalls:Color Opaque=true;
                           entry "+ Censored";
                        endlayout;
                     endif;
                  else
                     if (PLOTTEST=1)
                        layout gridded / rows=1 autoalign=(TOPRIGHT BOTTOMLEFT TOP BOTTOM) border=true BackgroundColor=
                           GraphWalls:Color Opaque=true;
                           if (PVALUE < .0001)
                              entry TESTNAME " p " eval (PUT(PVALUE, PVALUE6.4));
                           else
                              entry TESTNAME " p=" eval (PUT(PVALUE, PVALUE6.4));
                           endif;
                        endlayout;
                     endif;
                  endif;
               endlayout;
            endcell;
            cell;
               layout overlay / walldisplay=none xaxisopts=(display=none);
                  axistable x=TATRISK value=ATRISK / display=(label) valueattrs=(size=7pt) class=CLASSATRISK colorgroup=CLASSATRISK ;
 				  drawtext 'Number at Risk' / x=3 y=55 width=9 rotate= 90;
               endlayout;
            endcell;
         endlayout;
      endif;
      if (_BYTITLE_)
         entrytitle _BYLINE_ / textattrs=GRAPHVALUETEXT;
      else
         if (_BYFOOTNOTE_)
            entryfootnote halign=left _BYLINE_;
         endif;
      endif;
   EndGraph;
end;

which part of the template code do I need to change for this ?

2 REPLIES 2
ballardw
Super User

What are the actual values of your class variable?

 

And same note as the other question about the DATA and the actual submitted code to generate plots.

 

A template without the code using the template is not sufficient to diagnose things in detail.

Reeza
Super User
By removing the value from the format or variable value. I suspect what you need to do is code it as 1/2 and use a format to have it displayed correctly.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1204 views
  • 0 likes
  • 3 in conversation