The SAS Output Delivery System and reporting techniques

ODS Proc Report labels

Reply
N/A
Posts: 0

ODS Proc Report labels

I am using the following code to create new variables but am having trouble creating the label/column header.

This is a monthly table - each month a new column is appended with that month's data. I am capturing the variable names and labels in macro variables and then using these to create new variables. The label name is a number, signifying the year and month ie this month's column is 200903. When I try to put the macro variable with this value as a column header, I get an error. Code as below.

proc contents data=reports.times_&yyyymm. out=work.contents noprint;
run;

data _null_;
set WORK.contents (where=(name ne "metric"));
call symput('var'||compress(_N_),compress(name));
call symput('label'||compress(_N_),compress(label));
call symput('n',compress(_N_));
run;


proc report data = reports.times_&yyyymm. NOWINDOWS NOCENTER MISSING
style(column)={font_size=10pt}
style(header)={font_size=10pt};
title;
title1 "Report 21";
footnote;
column metric _:;
%do i=1 %to &n;
column var&i;
define metric/display;
define &&var&i/display noprint;
define var&i/computed;
compute var&i/CHARACTER length=30 "&&label&i";
if index(metric,'LGD')>0
or index(metric,'PD')>0
or metric='Sum EL / Sum Pre-Severity EL' then var&i=put(&&var&i,&formb);
else var&i=put(&&var&i,&forma);
endcomp;
%end;
run;

Thanks in advance.
SAS Super FREQ
Posts: 8,868

Re: ODS Proc Report labels

Posted in reply to deleted_user
Hi:
The label string goes on the DEFINE statement for the variable, NOT on the COMPUTE statement.

cynthia
N/A
Posts: 0

Re: ODS Proc Report labels

Posted in reply to deleted_user
Thanks Cynthia

You are awesome!

Drew
Ask a Question
Discussion stats
  • 2 replies
  • 139 views
  • 0 likes
  • 2 in conversation