BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GregINGov
Calcite | Level 5

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):(Column).

      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

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ


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

2 REPLIES 2
Cynthia_sas
SAS Super FREQ


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

GregINGov
Calcite | Level 5

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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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