Help using Base SAS procedures

Proc Report By statement help

Reply
N/A
Posts: 0

Proc Report By statement help

I am trying to use the by variable in proc report using ODS HTML to create seperate tables for each value of the by variable but I get the following error.

ERROR: Output data set cannot be created for BY groups.

Does anyone know why I would get this error and how I can resolve it?

Thanks,
mdsasuser
Super Contributor
Super Contributor
Posts: 3,174

Re: Proc Report By statement help

Posted in reply to deleted_user
Share your code, please -- preferably the SAS log generated output with your complete code revealed. Info about SAS environment, version, remote/local SAS execution, are also most helpful information to have.

Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: Proc Report By statement help

ods html body = '\\\report_1.html';

proc report data = acs.rep_summ_1 out = nowd headline headskip missing
style(report)={font_face=arial bordercolor=gray}
style(column)={background=white font_size=.5 borderwidth = 0}
style(header)={background= blue foreground= white font_size =1.5 just = center};

Title "Using by Statement"

by var1 notsorted;

column var2 var3 var4 var5 var6 var7 var8;

define var2/display descending group left ;
define var3/display group left;
define var4/display group left;
define var5/display analysis sum left;
define var6/display analysis sum left ;
define var7/display analysis sum left ;
define var8/display left;

define var7/computed ;
compute var7;
var7= var5.sum - var6.sum;
endcomp;

define var8/computed format=percent6.2;
compute var8;
var8= var6.sum/var5.sum;
endcomp;

break after var2/ ol skip summarize style={background=gray foreground=white font_size=.8 font_weight=bold};
rbreak after/dol summarize style=[font_weight=bold];
run;

ODS HTML CLOSE;

I am using SAS 9.1 and remote SAS execution.

Thanks
Super Contributor
Posts: 394

Re: Proc Report By statement help

Posted in reply to deleted_user
[pre]
proc report data = acs.rep_summ_1 out = nowd headline headskip missing
[/pre]

Are you sure you want "out = nowd" on the PROC statement? The OUT= option takes a data set name. NOWD is the NOWINDOW option. Remove "out =" from the PROC statement unless you really want to create an output data set, in which case you need to add the name of the output data set.

However, in 9.1 PROC REPORT doesn't support the OUT= option when you have a BY statement.
Super Contributor
Super Contributor
Posts: 3,174

Re: Proc Report By statement help

Posted in reply to deleted_user
In the ODS statement, you specified BODY= and because you have the BY statement code, SAS wants to write separate framed-output components, requiring BODY= but also FRAME= and CONTENTS=. I am surprised you did not receive any other diagnostic error messages. Suggest you either code a FILE= parameter or re-consider the ODS HTML statement coding parameters being used. There is many examples and technical reference material at the SAS support http://support.sas.com/ website for consideration.

Scott Barry
SBBWorks, Inc.


SAS Notes and Concepts for ODS - identify the ODS HTML section:
http://support.sas.com/rnd/base/ods/templateFAQ/index.html

SAS ODS User's Guide - Dictionary of ODS Language Statements

ODS HTML Statement
http://support.sas.com/documentation/cdl/en/odsug/61723/HTML/default/a002175885.htm
Ask a Question
Discussion stats
  • 4 replies
  • 125 views
  • 0 likes
  • 3 in conversation