Help using Base SAS procedures

Help with PROC REPORT

Reply
Occasional Contributor
Posts: 16

Help with PROC REPORT

I am very new to SAS and I'm having a problem with PROC REPORT. I have looked through "The Little SAS Book" and some online doc, but can't find an answer. I have some raw data that I'm trying to calculate. can anyone tell me how to subtract one variable from another to produce a variable that is not in the input data or is that not possible with PROC REPORT? This is a sample of my input and also of my SAS code, if that helps. I am trying to sum VOLCAPGB then subtract the variable VOLCAPGB from the grouped variable CONTRACT to produce REMAINING. I basically want the end result to look like this(below in bold), of course this example is just a portion of my data, its rather large. Any help would be greatly appreciated.

CONTRACT VOLCAPGB REMAINING
163000 160 162840


(Input Data)

CONTRACT VOLCAPGB

163000 27
163000 27
163000 27
163000 27
163000 27
163000 27


PROC REPORT DATA=MAP HEADLINE NOWD;

COLUMN CONTRACT VOLCAPGB REMAINING;

DEFINE CONTRACT / GROUP;
DEFINE VOLCAPGB / ANALYSIS SUM;
DEFINE REMAINING / ?????????????????????
Super Contributor
Posts: 394

Re: Help with PROC REPORT

Posted in reply to Nooby1Konoby
Sounds like REMAINING is a "computed" variable. See this doc: http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a002473627.htm#a003072061.
Occasional Contributor
Posts: 16

Re: Help with PROC REPORT

I tried to compute the REMAINING variable and my job fails with the below message; which appears that I'm not able to compute the variable with another one that is being analized. I'll keep digging to see what I can come up with. Thanks again for the help.


ERROR: There is more than one ANALYSIS usage associated with
the column defined by the following elements.

Name Usage
-------------------------------- --------
VOLCAPGB ANALYSIS
REMAINING COMPUTED
Occasional Contributor
Posts: 16

Re: Help with PROC REPORT

Posted in reply to Nooby1Konoby
Tim

Sorry I found that I had a syntax error. I was able to get the compute to work, kind of. It is giving me a value of zero, but i think that should be easy to fix. Thanks you very much for the information and the help.
Super Contributor
Posts: 394

Re: Help with PROC REPORT

Posted in reply to Nooby1Konoby
Since VOLCAPGB is an analysis variable you'll have to refer to its value by its statistic, VOLCAPGB.SUM. See "Using Compute Blocks" on this page: http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a000146851.htm.
Occasional Contributor
Posts: 16

Re: Help with PROC REPORT

Tim

Thank you very much! This worked like a charm. I'll have to spend some more time reading over the links that you provided me. I'm glad I joined this forum, thanks again!
Ask a Question
Discussion stats
  • 5 replies
  • 805 views
  • 0 likes
  • 2 in conversation