Hi:
Here's an example that I had. It shows two things: there are a BUNCH of temporary variables and there's one COMPUTED variable (SILLYVAR). The difference between the two types of variables is outlined in a documentation topic entitled, "".
This is a very simple example of how certain values were saved into temporary variables in a compute block and then used -- in this case, at the end of the report.
cynthia
[pre]
ods listing close;
ods html file='c:\temp\use_temp_var.html' style=sasweb;
proc report data=sashelp.class nowd
style(lines)={just=l};
title 'Example: Using Temporary Variables';
title2 'HT12, HT14, HOLD12, HOLD14, AV12, AV14, HOLDALL and HTALL are the temp variables';
title3 'SillyVar is a COMPUTED variable';
column age n height weight sillyvar;
define age / group;
define n / 'Count';
define height / mean 'Avg Height';
define weight / mean 'Avg Weight';
define sillyvar / computed 'Silly Var';
compute sillyvar;
sillyvar = weight.mean - height.mean;
endcomp;
compute height;
if age = 12 then do; hold12 = n; ht12 = height.mean; end;
else if age = 14 then do; hold14 = n; ht14 = height.mean; end;
if _break_ = '_RBREAK_' then do; holdall = n; htall = height.mean; end;
endcomp;
rbreak after / summarize;
compute after;
av12 = hold12 / holdall;
av14 = hold14 / holdall;
line 'Average Height for 12 year olds: ' ht12 4.1 ;
line 'This group is ' av12 percent8.2 'of all ages which represents' hold12 2.0 ' divided by ' holdall 2.0;
line ' ';
line 'Average Height for 14 year olds: ' ht14 4.1 ;
line 'This group is ' av14 percent8.2 'of all ages which represents' hold14 2.0 ' divided by ' holdall 2.0;
line ' ';
line 'The overall Average Height is: ' htall 4.1;
endcomp;
run;
ods html close;
[/pre]