The SAS Output Delivery System and reporting techniques

Using variables in ODS with Proc Report

Reply
N/A
Posts: 0

Using variables in ODS with Proc Report

How do I use existing variables in a calculation without having to use them in the ODS output?

Example:

Var3=var1/var2;

I only want to use var3 on my ODS output. How do I do that?
SAS Super FREQ
Posts: 8,744

Re: Using variables in ODS with Proc Report

Hi:
You need to use the NOPRINT option for the variables. You still need them in a COLUMN statement:

[pre]
column name var1 var2 var3;
[/pre]

because they have to be available to PROC REPORT so it can do the division, but the NOPRINT option on the DEFINE statement -- just "hides" them:
[pre]
define name / order;
define var1 /sum noprint;
define var2 /sum noprint;
define var3 / computed;
compute var3;
var3 = var1.sum/var2.sum;
endcomp;
[/pre]

Just be sure that var1 and var2 are listed BEFORE var3 on the column statement. That's because PROC REPORT fills up the report row from LEFT to RIGHT. So they have to be listed in the COLUMN statement BEFORE var3.

cynthia

[/pre]
Ask a Question
Discussion stats
  • 1 reply
  • 108 views
  • 0 likes
  • 2 in conversation