The SAS Output Delivery System and reporting techniques

ODS proc report problem trying to compute group sum varibles

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 18
Accepted Solution

ODS proc report problem trying to compute group sum varibles

ODS proc report problem trying to compute group sum varibles

Below is a the potions of the log showing my error IQCURQTY AND IQQTYPLC has 0's in the data....but

I want to get the percentage on the sums of IQCURQTY AND IQQTYPLC.  How do I define it and and compute it for TT

   

+  by descending percent_done ccontid;

755       +  *****format cndtlet worddate18.*******;

756       +   column gitem IQCURQTY IQQTYPLC TT;

757       +  define gitem / group 'Item';

758       +  define IQCURQTY / 'Quantity';

759       +  define IQQTYPLC /  ' Quantity Place';

760       +  define TT / computed format=9.2;

761       +

762       +Compute  TT;

763       +                TT =IQQTYPLC_sum/IQCURQTY_sum;

764       +

765       +

766       +endcomp;

767       +  run;

NOTE: Variable IQCURQTY_sum is uninitialized.

NOTE: Variable IQQTYPLC_sum is uninitialized.

NOTE: Division by zero detected at line 1 column 18.

NOTE: Division by zero detected at line 1 column 18.

NOTE: Division by zero detected at line 1 column 18.

NOTE: Division by zero detected at line 1 column 18.

NOTE: Division by zero detected at line 1 column 18.

NOTE: Division by zero detected at line 1 column 18.

NOTE: Division by zero detected at line 1 column 18.

NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to missing values.

      Each place is given by: (Number of times) at (Line)Smiley SadColumn).

      7 at 1:18  

NOTE: The above message was for the following BY group:

      percent_done=1.3341645885 CCONTID=CCCVVV

NOTE: There were 85 observations read from the data set WORK.REPORT23.

NOTE: PROCEDURE REPORT used (Total process time):

      real time           0.65 seconds

      cpu time            0.09 seconds

This is what I am looking for in my report

Item     Quantity    Quantity Place      TT    what I am looking for TT to be

      1         7.000          2.000               .                .285              

      2        3824.000     3065.140           .                .801   

      3        2262.000     2185.730          .                .966 

      4         265.000      281.310           .               1.061          

      6        8282.000    12883.010          .              1.555

      7      254556.920   264040.305          .             1.037

      8        5018.000     3826.000          .                 .762


Accepted Solutions
Solution
‎03-16-2014 11:56 AM
SAS Super FREQ
Posts: 8,820

Re: ODS proc report problem trying to compute group sum varibles


Hi:

  PROC REPORT is telling you part of the problem with this message:

NOTE: Variable IQCURQTY_sum is uninitialized.

NOTE: Variable IQQTYPLC_sum is uninitialized.

  Why do you have IQQTYPLC_sum??? That is not the correct way to reference a numeric item that has a usage of SUM. Instead of this:

TT =IQQTYPLC_sum/IQCURQTY_sum;

the correct syntax would be something like:

TT =IQQTYPLC.sum/IQCURQTY.sum;

  I'd suggest reading the PROC REPORT documentation on how to use a compound name to reference numeric report items:

Base SAS(R) 9.4 Procedures Guide, Second Edition

where the documentation clearly explains that a compound name is:

variable-name.statistic

cynthia

View solution in original post


All Replies
Solution
‎03-16-2014 11:56 AM
SAS Super FREQ
Posts: 8,820

Re: ODS proc report problem trying to compute group sum varibles


Hi:

  PROC REPORT is telling you part of the problem with this message:

NOTE: Variable IQCURQTY_sum is uninitialized.

NOTE: Variable IQQTYPLC_sum is uninitialized.

  Why do you have IQQTYPLC_sum??? That is not the correct way to reference a numeric item that has a usage of SUM. Instead of this:

TT =IQQTYPLC_sum/IQCURQTY_sum;

the correct syntax would be something like:

TT =IQQTYPLC.sum/IQCURQTY.sum;

  I'd suggest reading the PROC REPORT documentation on how to use a compound name to reference numeric report items:

Base SAS(R) 9.4 Procedures Guide, Second Edition

where the documentation clearly explains that a compound name is:

variable-name.statistic

cynthia

Occasional Contributor
Posts: 18

Re: ODS proc report problem trying to compute group sum varibles

Cynthia,


Thanks for the Link to the Procedures Guide.  I'll start reading it.  I had a ODS class years ago and I have two books one on ODS and the other on reports.

One of them was showing me (dot)sum but not like I was trying to use it.  So as you indicated I was not sure what NOTE: Variable IQCURQTY_sum is uninitialized.

was meaning.  I should have tried and google the note.


Thanks also for the syntax was looking for.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 519 views
  • 0 likes
  • 2 in conversation