<?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: Proc SGPlot in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SGPlot/m-p/592663#M287436</link>
    <description>&lt;P&gt;See the article &lt;A href="https://blogs.sas.com/content/iml/2015/11/16/label-markers-several-vars.html" target="_self"&gt;"Label markers in graphs by using the values of several variables"&lt;/A&gt;, which shows how to concatenate two values into one string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You didn't post data, so I don't know what form your data are in, but here is a complete example that computes the means, forms a label variable, and plots the data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* compute average mpg_city for each type and origin of vehicles */
proc means data=Sashelp.cars(where=(Type^="Hybrid"));
class Type Origin;
var mpg_city;
output out=MeanOut(where=(not missing(Origin))) mean=;
run;

/* create a new label variable. See
   https://blogs.sas.com/content/iml/2015/11/16/label-markers-several-vars.html
*/
data Want;
set MeanOut;
length labl $15;    /* NAME holds 8 characters. Allow for delimiter and age */
labl = "Avg=" || put(MPG_City, 4.1) || ": N=" || put(_FREQ_, 3.);  /* convert to character */
run;

proc sgplot data=Want;
series x=Type y=MPG_City / group=Origin markers datalabel=labl 
              curvelabel curvelabelpos=min; 
xaxis grid;
yaxis grid;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 30 Sep 2019 13:33:07 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2019-09-30T13:33:07Z</dc:date>
    <item>
      <title>Proc SGPlot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SGPlot/m-p/592640#M287435</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using SAS 9.4.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating a line graph of the average satisfaction score for a group of people. Is it possible to have the number of people (n) who contributed a score displayed on the line? Meaning I want to see essentially the number of people contributing a score and not the acutal average across the multiple time points. Below is a copy of my code, I know how to put the average at each time point on the line but am not sure how to put the number of respondents or if that is even possible. Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SGPLOT DATA = have;&lt;BR /&gt;where event_name = 'A' or 'G' or 'L'&lt;BR /&gt;or 'M' or 'N';&lt;BR /&gt;SERIES X = event_name Y = AVG_SATISTFACTION / group= failure datalabel = AVG_SATISTFACTION&lt;BR /&gt;MARKERS LINEATTRS = (THICKNESS = 2);&lt;BR /&gt;TITLE 'Average Satistfaction by Failure';&lt;BR /&gt;yaxis label = 'Average Satistfaction Captured';&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 12:08:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SGPlot/m-p/592640#M287435</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-09-30T12:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SGPlot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SGPlot/m-p/592663#M287436</link>
      <description>&lt;P&gt;See the article &lt;A href="https://blogs.sas.com/content/iml/2015/11/16/label-markers-several-vars.html" target="_self"&gt;"Label markers in graphs by using the values of several variables"&lt;/A&gt;, which shows how to concatenate two values into one string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You didn't post data, so I don't know what form your data are in, but here is a complete example that computes the means, forms a label variable, and plots the data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* compute average mpg_city for each type and origin of vehicles */
proc means data=Sashelp.cars(where=(Type^="Hybrid"));
class Type Origin;
var mpg_city;
output out=MeanOut(where=(not missing(Origin))) mean=;
run;

/* create a new label variable. See
   https://blogs.sas.com/content/iml/2015/11/16/label-markers-several-vars.html
*/
data Want;
set MeanOut;
length labl $15;    /* NAME holds 8 characters. Allow for delimiter and age */
labl = "Avg=" || put(MPG_City, 4.1) || ": N=" || put(_FREQ_, 3.);  /* convert to character */
run;

proc sgplot data=Want;
series x=Type y=MPG_City / group=Origin markers datalabel=labl 
              curvelabel curvelabelpos=min; 
xaxis grid;
yaxis grid;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Sep 2019 13:33:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SGPlot/m-p/592663#M287436</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-09-30T13:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SGPlot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SGPlot/m-p/592667#M287437</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/194348"&gt;@GS2&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you would need to create a variable containing the number of respondents in a preliminary step (typically in the same step in which you calculated the average) and then use this variable in the DATALABEL= option -- as has been suggested already by Rick_SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Moreover, you should correct the serious logical error in your WHERE statement, which should read:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where event_name in ('A' 'G' 'L' 'M' 'N');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I would also avoid typos such as "Satis&lt;FONT size="3" color="#FF0000"&gt;&lt;STRONG&gt;t&lt;/STRONG&gt;&lt;/FONT&gt;faction" in titles, labels and variable names.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 13:40:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SGPlot/m-p/592667#M287437</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-09-30T13:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SGPlot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SGPlot/m-p/592670#M287438</link>
      <description>&lt;P&gt;Thank you for your thoughts. The "logical error" was intentional as their are other time points and I wanted to see across all of the timepoints not just the ones with observations.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did end up creating a variable prior to the sgplot to work it out.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 13:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SGPlot/m-p/592670#M287438</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-09-30T13:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SGPlot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SGPlot/m-p/592680#M287439</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/194348"&gt;@GS2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The "logical error" was intentional as their are other time points and I wanted to see across all of the timepoints not just the ones with observations.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just to clarify: Your WHERE condition uses 'G', 'L', etc. as Boolean values and these are interpreted as TRUE because they are not missing. As a result, the condition is &lt;EM&gt;always true&lt;/EM&gt;, which is normally pointed out in the SAS log:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#0000FF"&gt;WHERE 1 /* an obviously TRUE WHERE clause */ ;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;So, writing &lt;FONT face="courier new,courier"&gt;where 1;&lt;/FONT&gt;&amp;nbsp;or just omitting/commenting out the WHERE statement would have had the same effect. This is why it seemed strange to me that you wrote a rather complicated condition to achieve that.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 14:07:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SGPlot/m-p/592680#M287439</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-09-30T14:07:41Z</dc:date>
    </item>
  </channel>
</rss>

