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

Hello,

Can anyone help me to figure out following issue.

I am trying to call variable(variable name is PLAT and its value is 192 in dataset) in proc template  using  LAYOUT GRIDDED / columns=2 rows=2 border=true autoalign=(topleft topright bottomleft bottomright);

entry halign left ' Baseline Platlet count';

entry halign left PLAT;

 

and wants to display its value on the graph.

But some reason i am not able to populate its value on graph, instead it populates label and value i applied  in quotation marks  in proc sgrender.

proc sgrender data=new template=Product1; dynamic PLAT ="PLAT" varlable="Baseline Platlet count="; by subjid;

 

In sort i am trying to populate "192" instead of "PLAT" in graph.

sgplot.PNG

sg_data.PNG

proc template;
define statgraph Product1;
dynamic PLAT  ;
BeginGraph /designwidth=800 designheight=400px ;

      layout lattice / rows=1 rowweights=(0.75 0.17 0.08) columns=1 columnDataRange=unionall;

    layout overlay /
	
  yaxisopts=(griddisplay=on /*label="Analysis value" */ ) 
  xaxisopts=(griddisplay=on display=(ticks tickvalues label) label='VISIT' offsetmin=.05 offsetmax=.05 
              linearopts=(viewmin=0 viewmax=81 ))
  x2axisopts=(griddisplay=on display= none  offsetmin=.05 offsetmax=.05 
              linearopts=(viewmin=0 viewmax=81 ));

        layout gridded / columns=2 rows=2  border=true autoalign=(topleft topright bottomleft bottomright);
			  /*- Line 4 -*/
          entry textattrs=(size=10) halign=left "Baseline Platlet count=";
          entry halign=left PLAT;
		  endlayout;

	  seriesplot y=aval x=avisit /  lineattrs=(thickness=2.5 color=black PATTERN=1) name="STEP";
	   discretelegend "STEP" / location=outside;
	   scatterplot y=aval x=avisit /markerattrs=(size=8 color=black symbol=circlefilled transparency = .05) ;
    scatterplot y=aval2 x=avisit_1 /markerattrs=(size=8 color=red symbol=triangle transparency = .05) xaxis=x2;


endlayout;
   endlayout;
   EndGraph;
end;
run;

proc sgrender data=new  template=Product1;
  dynamic PLAT ="PLAT" varlable="Baseline Platlet count=";
by subjid;
run;

Any help will be appreciated. 

 

Thank you,

 

1 ACCEPTED SOLUTION

Accepted Solutions
PhilC
Rhodochrosite | Level 12

OK, use:

layout datapanel classvars=(country year)

where country year is your "PLAT".  With:

HEADERLABELDISPLAY=NONE
INSET=(country year)
INSETOPTS=(CONTENTDISPLAY=LABELVALUE HALIGN=LEFT SEPARATOR="=")
columns=1 rows=1 rowdatarange=union

 

proc template;
 define statgraph layoutdatapanel;
  begingraph;
    entrytitle "Annual Furniture Sales Comparisons";    
    layout datapanel classvars=(country year) / 
/*      columns=4 rows=3 rowdatarange=union*/
      /**********************/
      HEADERLABELDISPLAY=NONE
      INSET=(country year)
      INSETOPTS=(CONTENTDISPLAY=LABELVALUE HALIGN=LEFT SEPARATOR="=")
      columns=1 rows=1 
      /**********************/
rowdatarange=union /* headerlabeldisplay=value */ headerbackgroundcolor=GraphAltBlock:color rowaxisopts=(display=(tickvalues) griddisplay=on linearopts=(tickvalueformat=dollar12.)) columnaxisopts=(display=(tickvalues) timeopts=(tickvalueformat=monname3.)); layout prototype / cycleattrs=true; seriesplot x=month y=TotalActual / name="Actual"; seriesplot x=month y=TotalPredict / name="Predict"; endlayout; sidebar / align=top; discretelegend "Actual" "Predict" / border=false; endsidebar; endlayout; endgraph; end; run; proc summary data=sashelp.prdsal2 nway; class country year month; var actual predict; output out=prdsal2 sum=TotalActual TotalPredict; run; proc sgrender data=prdsal2 template=layoutdatapanel; where country="U.S.A." AND year=1995; run; proc sgrender data=prdsal2 template=layoutdatapanel; where country="Canada" AND year=1996; run;

 

View solution in original post

5 REPLIES 5
PhilC
Rhodochrosite | Level 12

Using a GTL example, I think you need to use Layout DataPanel, but I'm assuming that you want your variable PLAT to change and be another value later.  Or maybe, because I might misunderstand what you want.  You might just a where statement in PROC SGRENDER.

 

Using: Example: | SAS Help Center: LAYOUT DATAPANEL Statement

 

Here I've changed the template in the example to put one graph in the window then I select individual values of the "classvars" country and year in the where statement of PROC SGRENDER.  This obviously doesn't look as nice as what you've set up with your text boxes, but -anyway- this is what I have experience with.

 


proc template; define statgraph layoutdatapanel; begingraph; entrytitle "Annual Furniture Sales Comparisons"; layout datapanel classvars=(country year) / /* columns=4 rows=3 rowdatarange=union*/ columns=1 rows=1 rowdatarange=union headerlabeldisplay=value headerbackgroundcolor=GraphAltBlock:color rowaxisopts=(display=(tickvalues) griddisplay=on linearopts=(tickvalueformat=dollar12.)) columnaxisopts=(display=(tickvalues) timeopts=(tickvalueformat=monname3.)); layout prototype / cycleattrs=true; seriesplot x=month y=TotalActual / name="Actual"; seriesplot x=month y=TotalPredict / name="Predict"; endlayout; sidebar / align=top; discretelegend "Actual" "Predict" / border=false; endsidebar; endlayout; endgraph; end; run; proc summary data=sashelp.prdsal2 nway; class country year month; var actual predict; output out=prdsal2 sum=TotalActual TotalPredict; run; proc sgrender data=prdsal2 template=layoutdatapanel; where country="U.S.A." AND year=1995; run; proc sgrender data=prdsal2 template=layoutdatapanel; where country="Canada" AND year=1996; run;

 

PhilC
Rhodochrosite | Level 12
 
PhilC
Rhodochrosite | Level 12

OK, use:

layout datapanel classvars=(country year)

where country year is your "PLAT".  With:

HEADERLABELDISPLAY=NONE
INSET=(country year)
INSETOPTS=(CONTENTDISPLAY=LABELVALUE HALIGN=LEFT SEPARATOR="=")
columns=1 rows=1 rowdatarange=union

 

proc template;
 define statgraph layoutdatapanel;
  begingraph;
    entrytitle "Annual Furniture Sales Comparisons";    
    layout datapanel classvars=(country year) / 
/*      columns=4 rows=3 rowdatarange=union*/
      /**********************/
      HEADERLABELDISPLAY=NONE
      INSET=(country year)
      INSETOPTS=(CONTENTDISPLAY=LABELVALUE HALIGN=LEFT SEPARATOR="=")
      columns=1 rows=1 
      /**********************/
rowdatarange=union /* headerlabeldisplay=value */ headerbackgroundcolor=GraphAltBlock:color rowaxisopts=(display=(tickvalues) griddisplay=on linearopts=(tickvalueformat=dollar12.)) columnaxisopts=(display=(tickvalues) timeopts=(tickvalueformat=monname3.)); layout prototype / cycleattrs=true; seriesplot x=month y=TotalActual / name="Actual"; seriesplot x=month y=TotalPredict / name="Predict"; endlayout; sidebar / align=top; discretelegend "Actual" "Predict" / border=false; endsidebar; endlayout; endgraph; end; run; proc summary data=sashelp.prdsal2 nway; class country year month; var actual predict; output out=prdsal2 sum=TotalActual TotalPredict; run; proc sgrender data=prdsal2 template=layoutdatapanel; where country="U.S.A." AND year=1995; run; proc sgrender data=prdsal2 template=layoutdatapanel; where country="Canada" AND year=1996; run;

 

GraphGuy
Meteorite | Level 14

Is there any reason in particular you are wanting to use SGrender, rather than SGplot?

 

unnati
Obsidian | Level 7

I have to create graph for each subject separately and it has to have its associated value of its PLAT count from that particular subject. So if i use Sgrender procedure with by statement i can create one PDF file for all subject. 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 1395 views
  • 0 likes
  • 3 in conversation