<?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 Options in proc summary in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703610#M215619</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset with many variables and obsevations. Most variables are numeric, but not all. I Use the proc summary to collapse data&amp;nbsp;by a Class variable. The Class variable is also numeric and represents the ID för members of a define group (group_ID). Is there any way to exclude the group_ID variable&amp;nbsp;(which is numeric) from the Var statement? The reason why each variable is not written in the Var statement is because they are so many.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc summary data=x;&lt;/P&gt;&lt;P&gt;var _numeric_&lt;/P&gt;&lt;P&gt;class group_ID;&lt;/P&gt;&lt;P&gt;ouput out=Y;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Dec 2020 13:15:21 GMT</pubDate>
    <dc:creator>MCB1</dc:creator>
    <dc:date>2020-12-04T13:15:21Z</dc:date>
    <item>
      <title>Options in proc summary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703610#M215619</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset with many variables and obsevations. Most variables are numeric, but not all. I Use the proc summary to collapse data&amp;nbsp;by a Class variable. The Class variable is also numeric and represents the ID för members of a define group (group_ID). Is there any way to exclude the group_ID variable&amp;nbsp;(which is numeric) from the Var statement? The reason why each variable is not written in the Var statement is because they are so many.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc summary data=x;&lt;/P&gt;&lt;P&gt;var _numeric_&lt;/P&gt;&lt;P&gt;class group_ID;&lt;/P&gt;&lt;P&gt;ouput out=Y;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 13:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703610#M215619</guid>
      <dc:creator>MCB1</dc:creator>
      <dc:date>2020-12-04T13:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Options in proc summary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703617#M215620</link>
      <description>&lt;P&gt;You could create a new variable which is the character variable equivalent of numeric variable GROUP_ID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 13:29:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703617#M215620</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-12-04T13:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: Options in proc summary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703618#M215621</link>
      <description>&lt;P&gt;&lt;EM&gt;Thanks, it is the easy way out. I hoped there was a way to avoid the transformation af the Group_ID from numeric to character. &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;/MCB&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 13:32:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703618#M215621</guid>
      <dc:creator>MCB1</dc:creator>
      <dc:date>2020-12-04T13:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Options in proc summary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703619#M215622</link>
      <description>&lt;P&gt;Since you will never use a group variable for calculations, such variables should always be stored as character. Fix that in your import process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, you will need to grab the names of all numeric variables from DICTIONARY.COLUMNS into a macro variable, excluding your group variable. The macro variable is then used in place of _numeric_:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select name into :varnames separated by " "
from dictionary.columns
where libname = "WORK" and memname = "X" and type = "num" and upcase(name) ne "GROUP_ID";
quit;

proc summary data=x;
var &amp;amp;varnames.;
class group_ID;
output out=Y;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Dec 2020 13:35:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703619#M215622</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-04T13:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: Options in proc summary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703622#M215625</link>
      <description>Thanks! I will try this solution as well. But you are right, I could tranfrom the Group_ID to a character.</description>
      <pubDate>Fri, 04 Dec 2020 13:38:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703622#M215625</guid>
      <dc:creator>MCB1</dc:creator>
      <dc:date>2020-12-04T13:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: Options in proc summary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703647#M215638</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/347506"&gt;@MCB1&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another simple solution would be to use one or two &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lrcon&amp;amp;docsetTarget=p0wphcpsfgx6o7n1sjtqzizp1n39.htm&amp;amp;locale=en#p1cr0027z6qx4an1maoh0fyizqtt" target="_blank" rel="noopener"&gt;name range lists&lt;/A&gt; in the VAR statement. If &lt;FONT face="courier new,courier"&gt;group_ID&lt;/FONT&gt; is the first or last numeric variable (in terms of &lt;SPAN&gt;logical position in the data set, see&amp;nbsp;&lt;/SPAN&gt;PROC CONTENTS output using the VARNUM option), a single list is sufficient, otherwise two.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example: Suppose that &lt;FONT face="courier new,courier"&gt;group_ID&lt;/FONT&gt; is the sixth of, say, eight or more variables. Then your VAR statement excluding it&amp;nbsp;would look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var &lt;EM&gt;firstvar&lt;/EM&gt;-numeric-&lt;EM&gt;fifthvar&lt;/EM&gt; &lt;EM&gt;seventhvar&lt;/EM&gt;-numeric-&lt;EM&gt;lastvar&lt;/EM&gt;;&lt;/PRE&gt;
&lt;P&gt;(with the actual variable names instead of &lt;EM&gt;&lt;FONT face="courier new,courier"&gt;firstvar&lt;/FONT&gt;&lt;/EM&gt;, &lt;EM&gt;&lt;FONT face="courier new,courier"&gt;fifthvar&lt;/FONT&gt;&lt;/EM&gt;, etc.).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 14:43:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703647#M215638</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-12-04T14:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Options in proc summary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703648#M215639</link>
      <description>Thank you, it is a good idea as well.</description>
      <pubDate>Fri, 04 Dec 2020 14:45:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703648#M215639</guid>
      <dc:creator>MCB1</dc:creator>
      <dc:date>2020-12-04T14:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Options in proc summary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703665#M215649</link>
      <description>&lt;P&gt;Use PROC MEANS.&amp;nbsp; The default is to summarize all numeric variable NOT mentioned in other statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods select none;
proc means stackods data=sashelp.class;
   class age;
   ods output summary=summary;
   run;
ods select all;
proc print;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 586px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/52295i322B31A0B247C0F7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 15:43:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Options-in-proc-summary/m-p/703665#M215649</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2020-12-04T15:43:21Z</dc:date>
    </item>
  </channel>
</rss>

