BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
4 REPLIES 4
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.
deleted_user
Not applicable
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
Tim_SAS
Barite | Level 11
[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.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 605 views
  • 0 likes
  • 3 in conversation