<?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: Why the error is coming in Proc Report? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Why-the-error-is-coming-in-Proc-Report/m-p/125848#M34613</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But I want an ordered output of population variable&lt;/P&gt;&lt;P&gt;How can I get that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Nov 2012 04:59:15 GMT</pubDate>
    <dc:creator>devarayalu</dc:creator>
    <dc:date>2012-11-14T04:59:15Z</dc:date>
    <item>
      <title>Why the error is coming in Proc Report?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-the-error-is-coming-in-Proc-Report/m-p/125846#M34611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PROC REPORT data=sql.countries nofs headline headskip;&lt;/P&gt;&lt;P&gt;TITLE'Population of Large Countries Grouped by Continent';&lt;/P&gt;&lt;P&gt;column continent population, sum;&lt;/P&gt;&lt;P&gt;define continent / group;&lt;/P&gt;&lt;P&gt;define population / order f=comma20.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: An ORDER variable appears above or below other report items.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Usage&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --------------------------------&amp;nbsp; --------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Population&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;&amp;nbsp; ORDER&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; STATISTIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2012 04:06:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-the-error-is-coming-in-Proc-Report/m-p/125846#M34611</guid>
      <dc:creator>devarayalu</dc:creator>
      <dc:date>2012-11-14T04:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Why the error is coming in Proc Report?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-the-error-is-coming-in-Proc-Report/m-p/125847#M34612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; If POPULATION is a numeric variable and you want the SUM of POPULATION, then ORDER is the incorrect usage for POPULATION. Instead, you should try the SUM statistic as the USAGE. Your use of a comma in the COLUMN statement implies that you are crossing or nesting POPULATION with SUM, which is technically not necessary, if you change your usage as shown:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;PROC REPORT data=sql.countries nofs;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; TITLE 'Population of Large Countries Grouped by Continent';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; column continent population;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define continent / group;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define population / sum f=comma20.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, given your TITLE, I would also expect to see a COUNTRY variable on the report. Or else, does CONTINENT also contain a COUNTRY name? But since you didn't explain your data it's hard to understand what your program is trying to accomplish.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2012 04:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-the-error-is-coming-in-Proc-Report/m-p/125847#M34612</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-11-14T04:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Why the error is coming in Proc Report?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-the-error-is-coming-in-Proc-Report/m-p/125848#M34613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But I want an ordered output of population variable&lt;/P&gt;&lt;P&gt;How can I get that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2012 04:59:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-the-error-is-coming-in-Proc-Report/m-p/125848#M34613</guid>
      <dc:creator>devarayalu</dc:creator>
      <dc:date>2012-11-14T04:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why the error is coming in Proc Report?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Why-the-error-is-coming-in-Proc-Report/m-p/125849#M34614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; You cannot summarize a variable using PROC REPORT and then also use that variable as an ordering variable. You did not say whether your data was already summarized or not, so I'm not sure of what approach to recommend. Basically, if your data are NOT summarized, you need to make 2 passes through your data. A first pass to make a summarizing pass and to create a variable to use for ordering.Then, if you want to summarize and order, you can use your "extra" variable or ordering variable to apply order, like descending order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; If your data are already summarized, then you have an easier time of it. PROC REPORT allows you to create an "alias" for an existing variable and so you can use the variable values for ordering and then use the same variable under an alias for display purposes. See the code sample below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;data pop;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; infile datalines;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; input Continent $ Population;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;return;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;datalines;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;North 1736142&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;South 2173552&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;East&amp;nbsp; 3841291&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;West&amp;nbsp; 4623657&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html file='c:\temp\sum_and_order.html';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title 'Already summarized';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc report data=pop nowd;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; column population continent population=disppop;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define population / order descending noprint;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define continent / order;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define disppop / sum 'Population' f=comma12.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; rbreak after / summarize;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html close;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2012 03:19:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Why-the-error-is-coming-in-Proc-Report/m-p/125849#M34614</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-11-15T03:19:27Z</dc:date>
    </item>
  </channel>
</rss>

