turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Help with PROC REPORT

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-26-2009 12:03 PM

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 / ?????????????????????

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 / ?????????????????????

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-26-2009 12:50 PM

Sounds like REMAINING is a "computed" variable. See this doc: http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a002473627.htm#a003072061.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-26-2009 01:13 PM

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

ERROR: There is more than one ANALYSIS usage associated with

the column defined by the following elements.

Name Usage

-------------------------------- --------

VOLCAPGB ANALYSIS

REMAINING COMPUTED

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-26-2009 01:35 PM

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.

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-26-2009 03:57 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-27-2009 08:13 AM

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!

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!