<?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: Understanding the code below - Newbie in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-code-below-Newbie/m-p/429890#M281534</link>
    <description>&lt;P&gt;When you say summarize the variance PRCE, is it summing up the prices based on the CUSIP and date?&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;The code is missing a semi colon on the first line and missing a RUN; at the end. See the comments in the code below that helps to explain what it's doing. If you have further questions please post back.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;PROC&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;SUMMARY&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;DATA&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;testdat&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;Input; *specify to run a summary procedure on the data set INPUT;&lt;/SPAN&gt;

&lt;SPAN class="token statement"&gt;CLASS&lt;/SPAN&gt; CUSIP &lt;SPAN class="token function"&gt;Date&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;; *Group the summaries by CUSIP and DATE;&lt;/SPAN&gt;

&lt;SPAN class="token keyword"&gt;VAR&lt;/SPAN&gt; PRCE&lt;SPAN class="token punctuation"&gt;; *Summarize the variable PRCE;&lt;/SPAN&gt;

OUTPUT OUT&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;testdat&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;range_all &lt;SPAN class="token function"&gt;range&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;range_all &lt;SPAN class="token function"&gt;n&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;countall &lt;SPAN class="token punctuation"&gt;; *output the results to a dataset called range_all, the statistics being calculated are the RANGE and N(count). The RANGE is stored in a variable called range_all and the count is stored in countall;&lt;BR /&gt;&lt;BR /&gt;Run;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/188483"&gt;@Vinz867&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;I am a newbie with SAS. I need help in understanding the code below. Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SUMMARY DATA=testdat.Input

CLASS CUSIP Date;

VAR PRCE;

OUTPUT OUT=testdat.range_all range=range_all n=countall ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jan 2018 05:12:19 GMT</pubDate>
    <dc:creator>Vinz867</dc:creator>
    <dc:date>2018-01-23T05:12:19Z</dc:date>
    <item>
      <title>Understanding the code below - Newbie</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-code-below-Newbie/m-p/429883#M281532</link>
      <description>&lt;P&gt;I am a newbie with SAS. I need help in understanding the code below. Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SUMMARY DATA=testdat.Input

CLASS CUSIP Date;

VAR PRCE;

OUTPUT OUT=testdat.range_all range=range_all n=countall ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 04:42:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-the-code-below-Newbie/m-p/429883#M281532</guid>
      <dc:creator>Vinz867</dc:creator>
      <dc:date>2018-01-23T04:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding the code below - Newbie</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-code-below-Newbie/m-p/429886#M281533</link>
      <description>&lt;P&gt;The code is missing a semi colon on the first line and missing a RUN; at the end. See the comments in the code below that helps to explain what it's doing. If you have further questions please post back.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;PROC&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;SUMMARY&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;DATA&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;testdat&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;Input; *specify to run a summary procedure on the data set INPUT;&lt;/SPAN&gt;

&lt;SPAN class="token statement"&gt;CLASS&lt;/SPAN&gt; CUSIP &lt;SPAN class="token function"&gt;Date&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;; *Group the summaries by CUSIP and DATE;&lt;/SPAN&gt;

&lt;SPAN class="token keyword"&gt;VAR&lt;/SPAN&gt; PRCE&lt;SPAN class="token punctuation"&gt;; *Summarize the variable PRCE;&lt;/SPAN&gt;

OUTPUT OUT&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;testdat&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;range_all &lt;SPAN class="token function"&gt;range&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;range_all &lt;SPAN class="token function"&gt;n&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;countall &lt;SPAN class="token punctuation"&gt;; *output the results to a dataset called range_all, the statistics being calculated are the RANGE and N(count). The RANGE is stored in a variable called range_all and the count is stored in countall;&lt;BR /&gt;&lt;BR /&gt;Run;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/188483"&gt;@Vinz867&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I am a newbie with SAS. I need help in understanding the code below. Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SUMMARY DATA=testdat.Input

CLASS CUSIP Date;

VAR PRCE;

OUTPUT OUT=testdat.range_all range=range_all n=countall ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 04:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-the-code-below-Newbie/m-p/429886#M281533</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-23T04:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding the code below - Newbie</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-code-below-Newbie/m-p/429890#M281534</link>
      <description>&lt;P&gt;When you say summarize the variance PRCE, is it summing up the prices based on the CUSIP and date?&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;The code is missing a semi colon on the first line and missing a RUN; at the end. See the comments in the code below that helps to explain what it's doing. If you have further questions please post back.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;PROC&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;SUMMARY&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;DATA&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;testdat&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;Input; *specify to run a summary procedure on the data set INPUT;&lt;/SPAN&gt;

&lt;SPAN class="token statement"&gt;CLASS&lt;/SPAN&gt; CUSIP &lt;SPAN class="token function"&gt;Date&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;; *Group the summaries by CUSIP and DATE;&lt;/SPAN&gt;

&lt;SPAN class="token keyword"&gt;VAR&lt;/SPAN&gt; PRCE&lt;SPAN class="token punctuation"&gt;; *Summarize the variable PRCE;&lt;/SPAN&gt;

OUTPUT OUT&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;testdat&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;range_all &lt;SPAN class="token function"&gt;range&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;range_all &lt;SPAN class="token function"&gt;n&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;countall &lt;SPAN class="token punctuation"&gt;; *output the results to a dataset called range_all, the statistics being calculated are the RANGE and N(count). The RANGE is stored in a variable called range_all and the count is stored in countall;&lt;BR /&gt;&lt;BR /&gt;Run;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/188483"&gt;@Vinz867&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;I am a newbie with SAS. I need help in understanding the code below. Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SUMMARY DATA=testdat.Input

CLASS CUSIP Date;

VAR PRCE;

OUTPUT OUT=testdat.range_all range=range_all n=countall ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 05:12:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-the-code-below-Newbie/m-p/429890#M281534</guid>
      <dc:creator>Vinz867</dc:creator>
      <dc:date>2018-01-23T05:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding the code below - Newbie</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-code-below-Newbie/m-p/430035#M281535</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/188483"&gt;@Vinz867&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;When you say summarize the variance PRCE, is it summing up the prices based on the CUSIP and date?&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, it calculates the N and Range of the variable PRCE, for each unique combination of CUSIP and DATE.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 15:32:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-the-code-below-Newbie/m-p/430035#M281535</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-23T15:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding the code below - Newbie</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-code-below-Newbie/m-p/430073#M281536</link>
      <description>&lt;P&gt;Since you did not include the NWAY option on your PROC SUMMARY statement this code will produce multiple sets of outputs in the same output dataset.&amp;nbsp; You can distinguish them by looking at the automatic variable _TYPE_ that it creates.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;In your example you have two CLASS variables so _TYPE_ will have four possible values that result from two binary flags.&lt;/P&gt;
&lt;P&gt;_TYPE_=00 will have one observation with the summary for all of the input data.&lt;/P&gt;
&lt;P&gt;_TYPE_=3 ( or '11'b ) will have one observation for each distinct combination of the two class variables.&lt;/P&gt;
&lt;P&gt;_TYPE_=2 and 1 ('10'b and '01'b) will have the summary for each distinct value of just one of the two class variables considered independently.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 16:32:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-the-code-below-Newbie/m-p/430073#M281536</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-01-23T16:32:22Z</dc:date>
    </item>
  </channel>
</rss>

