<?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: question on getting totals on first line in Developers</title>
    <link>https://communities.sas.com/t5/Developers/question-on-getting-totals-on-first-line/m-p/4238#M1914</link>
    <description>Hi Cynthia,&lt;BR /&gt;
&lt;BR /&gt;
  It worked.&lt;BR /&gt;
Thank you very much &lt;BR /&gt;
&lt;BR /&gt;
Raji</description>
    <pubDate>Mon, 20 Aug 2007 14:11:45 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-08-20T14:11:45Z</dc:date>
    <item>
      <title>question on getting totals on first line</title>
      <link>https://communities.sas.com/t5/Developers/question-on-getting-totals-on-first-line/m-p/4236#M1912</link>
      <description>Hi,&lt;BR /&gt;
 I need totals should be printed first line for each account. Then detail lines for that account. like this for every acoount.  &lt;BR /&gt;
 &lt;BR /&gt;
Ex. of output:&lt;BR /&gt;
&lt;BR /&gt;
Assigned          Liquidated          Difference&lt;BR /&gt;
$26000                 1000                 25000&lt;BR /&gt;
&lt;BR /&gt;
Pos#       Title        Name         Account&lt;BR /&gt;
120       Faculty      XXXX             26&lt;BR /&gt;
                             XXXX             26&lt;BR /&gt;
                             xxxx             26&lt;BR /&gt;
total: 3&lt;BR /&gt;
&lt;BR /&gt;
My code is :&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
&lt;BR /&gt;
length AcctSum $30;&lt;BR /&gt;
blank = "                                                  ";&lt;BR /&gt;
set adjunct end=no_more_data;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
*file print ods=(variable=(SumAmt Sumlqu SumAdjust ));&lt;BR /&gt;
file  print ods=(variables=(Pos#   title  Name account));&lt;BR /&gt;
by department;&lt;BR /&gt;
 put _ODS_;&lt;BR /&gt;
if first.department then do;&lt;BR /&gt;
 Asum=SumAmt;&lt;BR /&gt;
 lqusum=Sumlqu;&lt;BR /&gt;
 Adjustsum=sumAmt - sumlqu;&lt;BR /&gt;
 Amtsum='Assigned: ' || put(Asum,10.0);&lt;BR /&gt;
 Lsum='Liquidated: ' ||put(lqusum,10.0);&lt;BR /&gt;
 AdSum='Difference: ' ||put(Adjustsum,10.0);&lt;BR /&gt;
  put @1  AmtSum  @2 Lsum @3 AdSum; &lt;BR /&gt;
  &lt;BR /&gt;
end;&lt;BR /&gt;
My output that I am getting Now:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Pos #      Title            Name            Account&lt;BR /&gt;
120        Faculty          XXX                26&lt;BR /&gt;
Assigned : 26000             Liquidated:  1000        Difference: 25000&lt;BR /&gt;
120        Faculty         XXX                 26&lt;BR /&gt;
121          Staff           YYY                27 &lt;BR /&gt;
Assigned: 1000               Liquidated : 200            Difference:800&lt;BR /&gt;
121           Staff          YXY                27&lt;BR /&gt;
&lt;BR /&gt;
Give me any suggestions &lt;BR /&gt;
&lt;BR /&gt;
thank you&lt;BR /&gt;
Raji</description>
      <pubDate>Mon, 20 Aug 2007 12:59:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/question-on-getting-totals-on-first-line/m-p/4236#M1912</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-08-20T12:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: question on getting totals on first line</title>
      <link>https://communities.sas.com/t5/Developers/question-on-getting-totals-on-first-line/m-p/4237#M1913</link>
      <description>Hi:&lt;BR /&gt;
  You seem to have a timing issue. When you have FILE PRINT ODS -- that statement acts as a pointer to the file you're creating. Then, PUT _ODS_ or any PUT statements are executed in the order in which they're encountered. So, in your case, the&lt;BR /&gt;
[pre]&lt;BR /&gt;
by department;&lt;BR /&gt;
put _ODS_;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
is writing out the observation/row info BEFORE the FIRST.DEPARTMENT info (which is further down in the program). So you could try moving the put _ODS_ underneath the END statement for FIRST.DEPARTMENT.&lt;BR /&gt;
 &lt;BR /&gt;
Remember that you are writing ONE table with a fixed number of columns on EVERY row. This means that your VARIABLES= sub-options has to refer to the variables that you want to see in the table. So, if you have 3 variables listed in the sub-option, then PUT @1 writes to the first column, PUT @2 writes to the second column, etc. Also, you must respect the types of the variables with any other PUT statements (such as those you use to write information BEFORE and/or AFTER each department) -- For example, if you had this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
variables=(charvar numvar1 numvar2)&lt;BR /&gt;
[/pre]&lt;BR /&gt;
in your sub-option (1 character variable, followed by 2 numeric variables), then you could only write numeric variables to column 2 or column 3.&lt;BR /&gt;
 &lt;BR /&gt;
If you need more help with how DATA step and ODS work, you might consider contacting Tech Support.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Mon, 20 Aug 2007 13:54:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/question-on-getting-totals-on-first-line/m-p/4237#M1913</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-08-20T13:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: question on getting totals on first line</title>
      <link>https://communities.sas.com/t5/Developers/question-on-getting-totals-on-first-line/m-p/4238#M1914</link>
      <description>Hi Cynthia,&lt;BR /&gt;
&lt;BR /&gt;
  It worked.&lt;BR /&gt;
Thank you very much &lt;BR /&gt;
&lt;BR /&gt;
Raji</description>
      <pubDate>Mon, 20 Aug 2007 14:11:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/question-on-getting-totals-on-first-line/m-p/4238#M1914</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-08-20T14:11:45Z</dc:date>
    </item>
  </channel>
</rss>

