<?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 Means to get Statistics in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-to-get-Statistics/m-p/822406#M324752</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your advice. Sorry I was short on details in my post. It was close to 3 am when I posted the question and I was exhausted after a long day. My variables are all numbers except csp8 which is alphanumeric. Most numbers have decimals, except for cryr, which is an integer. I'll try to explicate better next time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;J.J.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 09 Jul 2022 02:39:01 GMT</pubDate>
    <dc:creator>jjsingh04</dc:creator>
    <dc:date>2022-07-09T02:39:01Z</dc:date>
    <item>
      <title>Proc Means to get Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-to-get-Statistics/m-p/822215#M324663</link>
      <description>&lt;P&gt;Is there some easier method than this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc means data=crspy2 noprint nway;
  class csp8 cryr;
  var abrm;
  output out=crspy3(drop=_:) skewness=retskew;
run;

proc sql; 
create table crspix (drop=abrm oneplus) as   
select crspy2.*, crspy3.*  
from crspy2, crspy3 

where crspy2.csp8=crspy3.csp8 ne "." 
and crspy2.cryr=crspy3.cryr 

order by crspy2.csp8, crspy3.cryr;
quit; &lt;/PRE&gt;
&lt;P&gt;to achieve what this does? I had to add on the Proc Sql because the output from the Proc Means (i.e. crspy3) only contains the variables csp8, cryr, and retskew. That does make sense to me, considering the presumed purpose of Proc Means. I'm just wondering if I can adjust the Proc Means code somehow so that the output would also have the (original) retadj and retsd variables. (It's okay if the original abrm and oneplus variables still go though, as I soon get rid of them anyway.) (FYI: Note that the (drop=_:) code only gets rid of the _TYPE_ and _FREQ_ variables, which is fine.)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;J.J.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 07:15:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-to-get-Statistics/m-p/822215#M324663</guid>
      <dc:creator>jjsingh04</dc:creator>
      <dc:date>2022-07-08T07:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means to get Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-to-get-Statistics/m-p/822226#M324671</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;I'm just wondering if I can adjust the Proc Means code somehow so that the output would also have the (original) retadj and retsd variables.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We don't know what your data looks like, we don't know anything about RETADJ and RETSD variables, and so we can't know what this actually means. Please show us a portion of your data, by creating &lt;FONT color="#FF0000"&gt;working&lt;/FONT&gt; SAS data step code typing it in yourself, or by following &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 10:10:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-to-get-Statistics/m-p/822226#M324671</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-08T10:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means to get Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-to-get-Statistics/m-p/822255#M324685</link>
      <description>&lt;P&gt;It depends on what you consider easier.&amp;nbsp; Here's a recommendation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SQL is sorting the data.&amp;nbsp; So you could simplify the program if you were to sort it yourself:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=crpsy2;
  by csp8 cryr;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This allows change to the rest of the steps, which could become:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=crspy2 noprint;
  by csp8 cryr;
  var abrm;
  output out=crspy3(drop=_:) skewness=retskew;
run;
data crspix (drop=abm oneplus);
   merge  crspy2 crspy3;
   by csp8 cryr;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I did remove your reference to missing values ... you could always add it back into the DATA step if you need to delete some observations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorted data removes the need for a CLASS statement, letting you use a BY statement instead.&amp;nbsp; That removes the need for the NWAY option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorted data allows you to use a simple MERGE in a DATA step, instead of SQL, to combine your data sets.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 15:56:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-to-get-Statistics/m-p/822255#M324685</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-07-08T15:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means to get Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-to-get-Statistics/m-p/822405#M324751</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help. I should've mentioned that my data had already been sorted but from what I understand of CLASS, it allows you to not have to sort the data first--unlike BY, right? I'm not too familiar with MERGE--thanks for the tip. I'll look into it further.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;J.J.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jul 2022 02:28:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-to-get-Statistics/m-p/822405#M324751</guid>
      <dc:creator>jjsingh04</dc:creator>
      <dc:date>2022-07-09T02:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means to get Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-to-get-Statistics/m-p/822406#M324752</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your advice. Sorry I was short on details in my post. It was close to 3 am when I posted the question and I was exhausted after a long day. My variables are all numbers except csp8 which is alphanumeric. Most numbers have decimals, except for cryr, which is an integer. I'll try to explicate better next time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;J.J.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jul 2022 02:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-to-get-Statistics/m-p/822406#M324752</guid>
      <dc:creator>jjsingh04</dc:creator>
      <dc:date>2022-07-09T02:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means to get Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-to-get-Statistics/m-p/823281#M325073</link>
      <description>&lt;P&gt;You're correct on all counts.&amp;nbsp; If the data set is already sorted, you don't need to sort it again.&amp;nbsp; CLASS does avoid the need for having sorted data.&amp;nbsp; And if your data is already in order, you can use a BY statement without sorting again.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 12:35:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-to-get-Statistics/m-p/823281#M325073</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-07-14T12:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means to get Statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-to-get-Statistics/m-p/824532#M325630</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;Thanks for clarifying. I thought about your solution after I posted that subsequent question and I like it very much. I guess I've just gotten so used to using Proc Sql that I didn't realize that there are much more succinct alternative ways of coding out there like Data Step Merge. Thank you for telling me about Data Step Merge. I will definitely be using it when I can hereon.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 01:50:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-to-get-Statistics/m-p/824532#M325630</guid>
      <dc:creator>jjsingh04</dc:creator>
      <dc:date>2022-07-21T01:50:23Z</dc:date>
    </item>
  </channel>
</rss>

