BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi

I am creating a sas ods pdf report using proc report. What i need to show is display one observation in two (or three) rows(s). In the final report i want to display few variables in top row , few variables in the second and then few in third row (and this completes one sas data observation, repeat the same for all the obsevations). This i need to do for the whole data. The report template is fixed always and the variables are also shown at the fixed place. How to do the same?
4 REPLIES 4
Cynthia_sas
Diamond | Level 26
Hi:
PROC REPORT (and most of the SAS reporting procedures) create tabular output in which every row on the report has the same number of columns. So, normally, for SASHELP.CLASS, you would not have NAME and SEX on row 1, HEIGHT and WEIGHT on row 2 and AGE on row 3 of a report, for example.

You said that "The report template is fixed always and the variables are also shown at the fixed place." Is the report already being created in the desired form? And, if so, how?

cynthia
deleted_user
Not applicable
I have a template generated from Microsoft Access which i need to replicate through SAS. In that fixed template i have lets say 10 variables in a dataset. 6 variables should come in one row, 2 in second and then rest 2 in third. This will be done for the subsequent observations then. I tried using split command in proc report but it dint help me much.
Ksharp
Super User
Hi.
I try to use proc report's line statement to get what you want.
But I do not know it is whether you exactly needed.
proc report's line statement is very powerful and useful.


[pre]
ods pdf file='c:\test.pdf' style=sasweb;
proc report data=sashelp.class nowd ;
column name sex age weight height;
define name /order noprint;
define sex /order noprint;
define age /order noprint;
define weight /order noprint;
define height/order noprint;
compute before height;
line @8 name $10. @20 sex $1. @25 age 2.;
line @10 weight 5.2 @20 height 5.2;
endcomp;
run;
ods pdf close;
[/pre]



Ksharp
Ksharp
Super User
[pre]
ods pdf file='c:\test.pdf' ;
proc report data=sashelp.class nowd style(report)={rules=none frame=void outputwidth=50%} ;
column name sex age weight height;
define name /order noprint;
define sex /order noprint;
define age /order noprint;
define weight /order noprint;
define height/order noprint;
compute before height;
line @8 name $10. @20 sex $1. @25 age 2.;
line @10 weight 5.2 @20 height 5.2;
endcomp;
run;
ods pdf close;
[/pre]



Ksharp

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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