BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I'm fairly new to SAS and have a very simple PROC PRINT procedure:

PROC PRINT SPLIT='*' NOOBS WIDTH=UNIFORM;
TITLE1 'TIME DETAIL';
BY NAM WEEK DTT;
PAGEBY NAM;
VAR NAM DTT MEM DES SDE SDC TYP TIM;
LABEL NAM = 'NAME';
LABEL DTT = 'DATE';
LABEL MEM = 'MEMBER';
LABEL DES = 'DESCRIPTION';
LABEL SDE = 'SUBJECT';
LABEL SDC = 'DESCRIPTION';
LABEL TYP = 'TYPE*OF*ENTRY';
LABEL TIM = 'TIME*REPORTED';
SUM TIM;

What I'm trying to do and haven't been able to so far is place all variables in one line except for the variable SDC. So I would like the following to print in the first line for each observation:

NAM DTT MEM DES SDE TYP TIM
SDC

and 'SDC' in the second line. How can I go about accomplishing this?
9 REPLIES 9
Cynthia_sas
SAS Super FREQ
Hi:
PROC PRINT doesn't work that way. Unless you used a DATA _NULL_ step with your own PUT statements, you would not normally be able to accomplish this with PROC PRINT.

Can you explain a bit more what the purpose of the report is and how many observations you would have on each page for a given NAM/WEEK/DTT combination??

cynthia
deleted_user
Not applicable
Hi Cynthia,

This report is intended for summarizing and adding sales man activities. What I'm trying to accomplish is a report with 1 or 2 pages per sales man, I don't expect to have more than 10 observations per sales man.

Each entry should contain 2 lines, the first line should be composed of the labels I mentioned and the 2nd line should be composed of only the variable SDC which is an entry description and I expect it to be up to 200 characters or so.

If PROC PRINT is not the way to go what would you suggest?
deleted_user
Not applicable
You may want to check the Linesize option for the proc print output.

options linesize=no_of_char_in_one_line;

Play around with the value of linesize to suit your requirements.
Cynthia_sas
SAS Super FREQ
Depending on what ODS destination she plans to use for the output (HTML, RTF, PDF, etc), not all destinations support the use of LINESIZE to control the way that output is formatted on the page. Only the LISTING window uses the LINESIZE option.

cynthia
deleted_user
Not applicable
I'm using PDF output, if LINESIZE is not supported for this output format what type of procedure would you suggest? I briefly looked at PROC TABULATE and REPORT but I don't know that those will help me any.
deleted_user
Not applicable
If you are using the PDF as an output destination then you may want to change the layout of the PDF document that you intend to write the proc print output to.

options orientation=landscape;
ods pdf file="pdf file location";

unless you have already tried this. 🙂

Regards
Cynthia_sas
SAS Super FREQ
Hi:
In addition to changing your output file orientation, you might find this previous forum posting on how to handle very wide tables to be useful:
http://support.sas.com/forums/thread.jspa?messageID=414ƞ

Or, in this other forum posting, there's an example of writing a program to split variables for display on two report rows:
http://support.sas.com/forums/thread.jspa?messageID=34485

cynthia
deleted_user
Not applicable
Thank you for the suggestions it shed some light into what I need to do. However I was able to find a simpler solution to what I was looking for although it took a lot of manipulation (ok maybe it wasn't easier). I was able to accomplish it using PROC REPORT in the following fashion

PROC REPORT HEADLINE HEADSKIP;
COLUMN NAM DTT TYP PPP DES SDC TIM;
DEFINE NAM / GROUP WIDTH=5 'Name';
DEFINE DTT / 'Date';
DEFINE TYP / 'Type';
DEFINE DES / 'Contact/Accoount' WIDTH=15;
DEFINE TYP / 'Entry Type'WIDTH=5;
DEFINE MEM / 'Type';
DEFINE SDC / DISPLAY WIDTH=75 FLOW 'Entry Description';
DEFINE TIM / 'Time Spent';

BREAK AFTER NAM / DOL SKIP SUPPRESS;
TITLE1 'Weekly Sales Activities';
TITLE2 ' ';


But there's one more thing that I'm trying to accomplish, I can't seem to be able to figure out how to put spacing in between each of the observations. There are about 20 - 30 observations per page and it looks really cluttered, any suggestions how I could achieve this?
Cynthia_sas
SAS Super FREQ
Hi:
Many of the options that you use do NOT work in the PDF destination. For example, WIDTH=, HEADLINE, HEADSKIP, FLOW, DOL and SKIP are all LISTING only options and are ignored by ODS RTF, ODS PDF and ODS HTML destinations.

Have you tried to create ODS PDF output with these options??? I suspect the results will not be as you desire. I thought you wanted the SDC description to be on an entirely separate report row from the rest of the variables on an obsevation. With the FLOW option, you are only making the cellwidth for the SDC column narrower, so it takes up multiple lines, instead of one line. You can accomplish this same thing with ODS PDF by using the CELLWIDTH option as shown in the program below. Compare the outputs from REPORT #1 and REPORT #2 in the PDF file (not in the LISTING destination. I think you will see that ODS offers other ways to cause "flow" and "wrapping" without trying to use LISTING-only syntax.

cynthia
[pre]
data makelong;
set sashelp.class;
where age ge 15;
var1 = 'AAA';
var2 = name;
length longvar $200;
tmp = 'abcdefghij klmnopqrst uvwxyz1234 ';
longvar = tmp || tmp || tmp || tmp ||tmp || tmp;
output;

var1 = 'BBB';
output;

run;

options linesize=256;
ods listing;
ods pdf file='c:\temp\compare_flow_cellwidth.pdf';

proc report data=makelong nowd HEADLINE HEADSKIP;
title '1) Let ODS decide the Width for Longvar';
title2 'Note how HEADLINE, HEADSKIP, FLOW, SKIP etc are all ignored';
column var1 var2 longvar;
define var1 /order;
define var2 /order;
define longvar / display width=75 flow;
break after var1 / dol skip suppress;
run;

proc report data=makelong nowd;
title '2) Use CELLWIDTH attribute for PDF to adjust size of LONGVAR cell';
column var1 var2 longvar;
define var1 /order;
define var2 /order;
define longvar / display
style(column)={cellwidth=3in};
compute after var1;
line ' ';
endcomp;
run;
ods _all_ close;
title;
[/pre]

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
  • 9 replies
  • 4587 views
  • 0 likes
  • 2 in conversation