<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: how I change the title in proc template to show a label of a variable instead of the variable na in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/how-I-change-the-title-in-proc-template-to-show-a-label-of-a/m-p/534775#M17778</link>
    <description>&lt;P&gt;OK, I think I understood now. The problem was something different than what I original asked for.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The iteminformation curves can be shown by proc irt. Proc IRT produce a dataset containing the values, and it then call proc sgrender with this dataset, and some dynamic value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The dataset, which I actually can get out with a "ods output" statement, is very bad organized. It has only four variables, which then contains information for all items I have. So, if I have lets say 8 items, then the first 101 observations contains information values for the first 4 items, and the next 101 observations contains information for the last 4 items. And, no labels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It now need some cumbersome, but simple work to get a nice graph out of this.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Feb 2019 11:32:34 GMT</pubDate>
    <dc:creator>JacobSimonsen</dc:creator>
    <dc:date>2019-02-12T11:32:34Z</dc:date>
    <item>
      <title>how I change the title in proc template to show a label of a variable instead of the variable name</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/how-I-change-the-title-in-proc-template-to-show-a-label-of-a/m-p/534763#M17775</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;Im trying to make a small change to the template of a statistical graphic plot. In the IIC plot from proc IRT I want the titles of each plot to be the variables labels instead of the variable name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found the template that produce the plot, and also the statement that produce the title.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the code below, _ITEM0 will write the variable name in the title. How can I change that to the label of that variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc template;
  source Stat.irt.Graphics.iteminfocurvepanel;
define statgraph Stat.IRT.Graphics.iteminfocurvepanel;
   notes "Plots of Item Curves ";
   dynamic _nItem _nRow _nCol _item0 _item1 _item2 _item3 _item4 _item5 _xmin _xmax _ymax _height _byline_ _bytitle_ _byfootnote_
   _itemlabel1;
   BeginGraph / designheight=_HEIGHT;
   …
…
…
...
         if (_NITEM&amp;gt;0)
            cell;
               cellheader;
                  entry halign=center  &lt;FONT color="#ff00ff"&gt;_ITEM0&lt;/FONT&gt; / textattrs=GRAPHLABELTEXT;
               endcellheader;
               Layout overlay / yaxisopts=(display=none) xaxisopts=(display=(line ticks tickvalues));
                  seriesplot x=TRAIT y=ITEMINFOI0;
               endlayout;
            endcell;
         endif;
..
...
...
...
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Feb 2019 09:57:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/how-I-change-the-title-in-proc-template-to-show-a-label-of-a/m-p/534763#M17775</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2019-02-12T09:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: how I change the title in proc template to show a label of a variable instead of the variable na</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/how-I-change-the-title-in-proc-template-to-show-a-label-of-a/m-p/534766#M17776</link>
      <description>&lt;P&gt;Well, its not really to do with the template, as that just takes in a dynamic value.&amp;nbsp; Its more about you sgrender call.&amp;nbsp; So you could:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000127812.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000127812.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Call label in a datastep before into a macro variable and do it that way:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set have (obs=1);
  call symput('lb',call label(yourvar));
run;

proc sgrender...
  define _item0="&amp;amp;lb."...
run;&lt;/PRE&gt;
&lt;P&gt;(Note not tested!!).&amp;nbsp; Although I would really say that if you are using a label in title (or anywhere, then its probably better to put that as string data in your data, then calling the sgrender with a variable - this way its flexible to use whatever is in the variable, and you don't need macro.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 10:14:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/how-I-change-the-title-in-proc-template-to-show-a-label-of-a/m-p/534766#M17776</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-02-12T10:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: how I change the title in proc template to show a label of a variable instead of the variable na</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/how-I-change-the-title-in-proc-template-to-show-a-label-of-a/m-p/534773#M17777</link>
      <description>&lt;P&gt;Thank you. Yes, I think you are right. That the sgrender procedure is called by the IRT procedure, not by me directly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Further, IRT doesnt output the dataset used for the iteminformation curves, so I can not even call the sgrender procedure myself.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 11:01:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/how-I-change-the-title-in-proc-template-to-show-a-label-of-a/m-p/534773#M17777</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2019-02-12T11:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: how I change the title in proc template to show a label of a variable instead of the variable na</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/how-I-change-the-title-in-proc-template-to-show-a-label-of-a/m-p/534775#M17778</link>
      <description>&lt;P&gt;OK, I think I understood now. The problem was something different than what I original asked for.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The iteminformation curves can be shown by proc irt. Proc IRT produce a dataset containing the values, and it then call proc sgrender with this dataset, and some dynamic value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The dataset, which I actually can get out with a "ods output" statement, is very bad organized. It has only four variables, which then contains information for all items I have. So, if I have lets say 8 items, then the first 101 observations contains information values for the first 4 items, and the next 101 observations contains information for the last 4 items. And, no labels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It now need some cumbersome, but simple work to get a nice graph out of this.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 11:32:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/how-I-change-the-title-in-proc-template-to-show-a-label-of-a/m-p/534775#M17778</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2019-02-12T11:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: how I change the title in proc template to show a label of a variable instead of the variable na</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/how-I-change-the-title-in-proc-template-to-show-a-label-of-a/m-p/534777#M17779</link>
      <description>&lt;P&gt;Sorry, never used proc irt, so do not know what the output from it is.&amp;nbsp; I would suggest starting by posting some example test data in the form of a datastep and show what you want out from it, so at least there is something to wor with.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 11:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/how-I-change-the-title-in-proc-template-to-show-a-label-of-a/m-p/534777#M17779</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-02-12T11:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: how I change the title in proc template to show a label of a variable instead of the variable na</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/how-I-change-the-title-in-proc-template-to-show-a-label-of-a/m-p/535136#M17788</link>
      <description>&lt;P&gt;Im not able show share the real data. But with simulated data I can show you here what I mean:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*simulate a dataset;
data simulation;
  array q{8,4} _temporary_;
  array alpha{4} _temporary_;

  array item{8} 3;
  array probability{5} _temporary_;
  label item1="Anxiety" item2="Depression" item3="Hostility" item4="Guilt feelings" item5="Hallucinations" item6="Emotional withdrawal" item7="Grandiosity" item8="Disorientation";
  do i=1 to dim(q);
    do k=1 to dim(alpha);
	alpha[k]=rand('normal',0,1);
	end;
	call sortn(of alpha(*));
    do k=1 to dim(alpha);
      q[i,k]=alpha[k];
	end;
  end;

  do person=1 to 200;
    p=rand('normal',0,1);
	do i=1 to dim(item);
	l=ifn(i=1,0.25,1);
	do k=1 to 5;
	  if k=1 then probability[k]=cdf('logistic',alpha[1],l*p,1);
	  else if k&amp;lt;5 then  probability[k]=cdf('logistic',alpha[k],l*p,1)-cdf('logistic',alpha[k-1],l*p,1);
	  else if k=5 then probability[k]=1-cdf('logistic',alpha[k-1],l*p,1);
	end;
	item[i]=rand('table',probability[1],probability[2],probability[3],probability[4],probability[5]);
	end;
	output simulation;
  end;
  keep item:;
run;


ods output iteminfocurve=iteminfocurve;
proc irt data=simulation plot=(iic) resfunc=graded;
  var item:;
run;
*the iic curve is missing the labels.

*Using the iteminfocurve dataset, we can put in the labels ;
proc format;
  value item 1="Anxiety" 2="Depression" 3="Hostility" 4="Guilt feelings" 5="Hallucinations" 6="Emotional withdrawal" 7="Grandiosity" 8="Disorientation";
run;
data iteminfocurve2;
  set iteminfocurve(in=a1 obs=101 keep=trait ItemInfoI0 rename=(ItemInfoI0=iteminfo) )
   iteminfocurve(in=a2 obs=101 keep=trait ItemInfoI1 rename=(ItemInfoI1=iteminfo))
    iteminfocurve(in=a3 obs=101 keep=trait ItemInfoI2 rename=(ItemInfoI2=iteminfo))
	 iteminfocurve(in=a4 obs=101 keep=trait ItemInfoI3 rename=(ItemInfoI3=iteminfo))
	  iteminfocurve(in=a5 firstobs=102 keep=trait ItemInfoI0 rename=(ItemInfoI0=iteminfo))
	   iteminfocurve(in=a6 firstobs=102 keep=trait ItemInfoI1 rename=(ItemInfoI1=iteminfo))
	    iteminfocurve(in=a7 firstobs=102 keep=trait ItemInfoI2 rename=(ItemInfoI2=iteminfo))
	    iteminfocurve(in=a8 firstobs=102 keep=trait ItemInfoI3 rename=(ItemInfoI3=iteminfo));
  format item item.;
  item=1*a1+2*a2+3*a3+4*a4+5*a5+6*a6+7*a7+8*a8;
run;&lt;BR /&gt;&lt;BR /&gt;
proc sgpanel data=iteminfocurve2;
  panelby item;
  series x=trait y=iteminfo;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Feb 2019 10:14:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/how-I-change-the-title-in-proc-template-to-show-a-label-of-a/m-p/535136#M17788</guid>
      <dc:creator>JacobSimonsen</dc:creator>
      <dc:date>2019-02-13T10:14:04Z</dc:date>
    </item>
  </channel>
</rss>

