<?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 Proc Means and sgplot in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-sgplot/m-p/50279#M13705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let's simplify things a little. The problem is the day variable is plotting alphabetically instead of the order of the series. Run this instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* just output the mean only and drop vars that begin with _;&lt;/P&gt;&lt;P&gt;proc summary data=tab4b;&lt;BR /&gt;var day3 day7 day15 day30 day90 day180 day360 day720;&lt;BR /&gt;output out=tab4c (drop=_:) mean=;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* rename transposed vars to something meaningful;&lt;/P&gt;&lt;P&gt;proc transpose data=tab4c out=tab4d (rename=(_name_=day col1=mean));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* change the day value - for example, day3 to day003;&lt;/P&gt;&lt;P&gt;data tab4e;&lt;BR /&gt;set tab4d;&lt;BR /&gt;length _n 8;&lt;BR /&gt;_n = substr( day, 4 );&lt;BR /&gt;day = cats( 'day', put( _n, z3. ));&lt;BR /&gt;drop _:;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc gplot data=tab4e;&lt;/P&gt;&lt;P&gt;plot mean*day;&lt;/P&gt;&lt;P&gt;symbol value=circle color=red interpol=spline;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Feb 2012 16:30:45 GMT</pubDate>
    <dc:creator>FloydNevseta</dc:creator>
    <dc:date>2012-02-09T16:30:45Z</dc:date>
    <item>
      <title>Proc Means and sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-sgplot/m-p/50277#M13703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to plot the mean of ser creatinine levels (64 obs) against different time points. I calculated the mean and then plotted it (the code may be lenghty). But on the x-axis the graph is generating in the order day15 day180 day3&amp;nbsp; day30 day360 day7 day720 day90 instead of day 3 through day720.&amp;nbsp; Could someone please take a look and help me resolve this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Hari&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc means data=tab4b mean;&lt;BR /&gt;var day3 day7 day15 day30 day90 day180 day360 day720;&lt;BR /&gt;output out=tab4c;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data tab4c;&lt;BR /&gt;set c(firstobs=4 obs=4);&lt;BR /&gt;drop _type_ _freq_ _stat_;&lt;BR /&gt;/*avg=mean(day3, day7, day15);*/&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc transpose data=c out= tab4d;&lt;BR /&gt;run;&lt;BR /&gt;data tab4e;&lt;BR /&gt;set tab4d(firstobs=3 obs=10);&lt;BR /&gt;keep day col4;&lt;BR /&gt;label col4=mean;&lt;BR /&gt;day=put(_name_, 8.);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc gplot data=tab4e;&lt;BR /&gt;plot col4*day;&lt;BR /&gt;symbol value=circle color=red interpol=spline;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2012 14:48:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-sgplot/m-p/50277#M13703</guid>
      <dc:creator>hnam</dc:creator>
      <dc:date>2012-02-09T14:48:38Z</dc:date>
    </item>
    <item>
      <title>Proc Means and sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-sgplot/m-p/50278#M13704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hnam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you are noticing is that the fields are in alphabetical order.&amp;nbsp; While you could conceivably change your variable names in TAB4B, it's just as easy to use this variation.&amp;nbsp; Add to your OUTPUT statement within PROC MEANS:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mean = day003 day007 day015 day030 day090 day180 day360 day720&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That will change the variable names in TAB4C, without having to change TAB4B.&amp;nbsp; Also, notice how the word MEAN on the PROC statement is affecting the printed report, but does not affect the output data set TAB4C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use this change that I'm recommending, you may have to change your subsequent program.&amp;nbsp; For example, there will only be one observation in TAB4C, so when you transpose you will end up using COL1 instead of COL4.&amp;nbsp; But it's worth the effort to familiarize yourself with the structure of output data sets from PROC MEANS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2012 15:34:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-sgplot/m-p/50278#M13704</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-02-09T15:34:04Z</dc:date>
    </item>
    <item>
      <title>Proc Means and sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-sgplot/m-p/50279#M13705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let's simplify things a little. The problem is the day variable is plotting alphabetically instead of the order of the series. Run this instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* just output the mean only and drop vars that begin with _;&lt;/P&gt;&lt;P&gt;proc summary data=tab4b;&lt;BR /&gt;var day3 day7 day15 day30 day90 day180 day360 day720;&lt;BR /&gt;output out=tab4c (drop=_:) mean=;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* rename transposed vars to something meaningful;&lt;/P&gt;&lt;P&gt;proc transpose data=tab4c out=tab4d (rename=(_name_=day col1=mean));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* change the day value - for example, day3 to day003;&lt;/P&gt;&lt;P&gt;data tab4e;&lt;BR /&gt;set tab4d;&lt;BR /&gt;length _n 8;&lt;BR /&gt;_n = substr( day, 4 );&lt;BR /&gt;day = cats( 'day', put( _n, z3. ));&lt;BR /&gt;drop _:;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc gplot data=tab4e;&lt;/P&gt;&lt;P&gt;plot mean*day;&lt;/P&gt;&lt;P&gt;symbol value=circle color=red interpol=spline;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2012 16:30:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-sgplot/m-p/50279#M13705</guid>
      <dc:creator>FloydNevseta</dc:creator>
      <dc:date>2012-02-09T16:30:45Z</dc:date>
    </item>
    <item>
      <title>Proc Means and sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-sgplot/m-p/50280#M13706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://communities.sas.com/people/Astounding" id="jive-525329347416858112803"&gt;Astounding&lt;/A&gt; said. SAS order the value based on alphabetical order.&lt;/P&gt;&lt;P&gt;You can customize the order by adding a blank before the value to cheat SAS.&lt;/P&gt;&lt;P&gt;Because a blank is before than all of other alpha character.&lt;/P&gt;&lt;P&gt;Like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;..............&lt;/P&gt;&lt;P&gt;proc transpose data=c out= tab4d;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data tab4d;&lt;/P&gt;&lt;P&gt; set tab4d;&lt;/P&gt;&lt;P&gt;length col $ 50 ; *make the variate long enough to hold the adding blanks;&lt;/P&gt;&lt;P&gt;select(col);&lt;/P&gt;&lt;P&gt;when('day3')&amp;nbsp;&amp;nbsp; col='&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; day3'; *day3 is the first value so need the most blanks;&lt;/P&gt;&lt;P&gt;when('day7')&amp;nbsp;&amp;nbsp; col='&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; day7';&lt;/P&gt;&lt;P&gt;.........................&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Feb 2012 08:06:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-and-sgplot/m-p/50280#M13706</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-02-10T08:06:49Z</dc:date>
    </item>
  </channel>
</rss>

