<?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 nesting in proc report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/nesting-in-proc-report/m-p/73645#M15848</link>
    <description>I couldnt nest the variables product and year-month and product and year columns to get the display as shown below:&lt;BR /&gt;
&lt;BR /&gt;
   2008-01                2009-01             2008&amp;amp;2009          2008&amp;amp;2009&lt;BR /&gt;
 comp  mydrug   comp    mydrug          comp                  mydrug&lt;BR /&gt;
&lt;BR /&gt;
data ex_trn1; &lt;BR /&gt;
SET ex_trn; &lt;BR /&gt;
yr_2008=sum(of _2008:);&lt;BR /&gt;
yr_2009=sum(of _2009:);&lt;BR /&gt;
run; &lt;BR /&gt;
&lt;BR /&gt;
proc report list NOWINDOWS data=ex_trn1 HEADLINE MISSING;&lt;BR /&gt;
COLUMN region bsm zip name adddress city  _2008: ,product  _2009:, product yr_2008, product yr_2009, product;</description>
    <pubDate>Tue, 29 Sep 2009 19:13:58 GMT</pubDate>
    <dc:creator>SASPhile</dc:creator>
    <dc:date>2009-09-29T19:13:58Z</dc:date>
    <item>
      <title>nesting in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/nesting-in-proc-report/m-p/73645#M15848</link>
      <description>I couldnt nest the variables product and year-month and product and year columns to get the display as shown below:&lt;BR /&gt;
&lt;BR /&gt;
   2008-01                2009-01             2008&amp;amp;2009          2008&amp;amp;2009&lt;BR /&gt;
 comp  mydrug   comp    mydrug          comp                  mydrug&lt;BR /&gt;
&lt;BR /&gt;
data ex_trn1; &lt;BR /&gt;
SET ex_trn; &lt;BR /&gt;
yr_2008=sum(of _2008:);&lt;BR /&gt;
yr_2009=sum(of _2009:);&lt;BR /&gt;
run; &lt;BR /&gt;
&lt;BR /&gt;
proc report list NOWINDOWS data=ex_trn1 HEADLINE MISSING;&lt;BR /&gt;
COLUMN region bsm zip name adddress city  _2008: ,product  _2009:, product yr_2008, product yr_2009, product;</description>
      <pubDate>Tue, 29 Sep 2009 19:13:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/nesting-in-proc-report/m-p/73645#M15848</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2009-09-29T19:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: nesting in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/nesting-in-proc-report/m-p/73646#M15849</link>
      <description>Hi:&lt;BR /&gt;
                          &lt;BR /&gt;
 I am confused by your question, because you say this is your desired result:&lt;BR /&gt;
[pre]&lt;BR /&gt;
2008-01 2009-01 2008&amp;amp;2009 2008&amp;amp;2009&lt;BR /&gt;
comp mydrug comp mydrug comp mydrug&lt;BR /&gt;
[/pre]&lt;BR /&gt;
  &lt;BR /&gt;
but you show many more variables than those above in your column statement:&lt;BR /&gt;
[pre]&lt;BR /&gt;
COLUMN region bsm zip name adddress city _2008: ,product _2009:, product yr_2008, product yr_2009, product; &lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
I am confused by your use of "colon" syntax...do you have multiple variables like:&lt;BR /&gt;
city_2008_1&lt;BR /&gt;
city_2008_2&lt;BR /&gt;
city_2008_3 or&lt;BR /&gt;
product_2009_1&lt;BR /&gt;
product_2009_2&lt;BR /&gt;
product_2009_3&lt;BR /&gt;
????&lt;BR /&gt;
&lt;BR /&gt;
You can use colon syntax in a column statement, but it might not work the way you expect in an ACROSS situation. For example, if you had grpvar, var1 and var2 and numvar in a dataset, you -might- put:&lt;BR /&gt;
[pre]&lt;BR /&gt;
column grpvar var:,numvar;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
However, in this situation, only VAR2 would be crossed with numvar...NOT VAR1 crossed with VAR2 crossed with NUMVAR. This is probably not what you want to happen. So, I'd recommend clarifying what your variables are and show some examples of the data and then examples of the desired output that show ALL the variables in the column statement in the desired output.&lt;BR /&gt;
 &lt;BR /&gt;
I'm also confused because this seems related to some of your other PROC REPORT and ACROSS questions, such as these previous postings:&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?messageID=20472俸" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=20472俸&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?messageID=24565念" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=24565念&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?messageID=20574偞" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=20574偞&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?messageID=23216媰" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=23216媰&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?messageID=20499倓" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=20499倓&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?messageID=20354侂" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=20354侂&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
ACROSS still works the way explained previously. If you want to CALCULATE the 2008 column value + 2009 column value by adding information from 2 columns, you would have to use ABSOLUTE column names in a COMPUTE block in PROC REPORT.&lt;BR /&gt;
 &lt;BR /&gt;
I'd recommend trying a simple PROC REPORT with ACROSS without the colon syntax. Also, reread the previous forum postings on the use of ACROSS items in PROC REPORT and decide whether you need to calculate the 2008+2009 column info or whether your data is simple ACROSS data that doesn't need any further calculations.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 29 Sep 2009 20:52:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/nesting-in-proc-report/m-p/73646#M15849</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-09-29T20:52:54Z</dc:date>
    </item>
  </channel>
</rss>

