BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bobbee
Calcite | Level 5

Hi. I just start to learn SAS and I need some help with my problem.

I need to make listing output to a common text file. The output must contain outputs of few PROC REPORT steps, but some of them should be in the same page.

When I try to make such output with code like this:

 

ods listing file = 'c:\myfile';

proc report data = mydata1;

run;

 

proc report data = mydata2;

run;

ods listing close;

 

this two outputs are placed in the same file, but they are in different pages. Each output begins with new page. I tried to find more information anywhere, but withuot any results. Also ODS doesn't provide such options for LISTING output. So I'm confused a bit.

I need output like below in the same page:

 

Age (years)

 N	         xx
 Mean	         xx.x
 SD	         xx.xx
 Median	         xx.x
 Min	         xx
 Max	         xx

Age Group: N(%)

 >17-<=35	 xx (xxx.x%)
 >35-<=50	 xx (xxx.x%)
 >50-<=65	 xx (xxx.x%)
 >65	         xx (xxx.x%)

 

Maybe someone could help me to find the solution, or tell me easier way than ods.

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:
I'm not sure why you need to produce this type of report in text file (which is what LISTING output is). It looks like a standard demographic report and most of my students use either PDF or RTF for this report type.

However, if you want to send output to the LISTING destination, specifically to a file, then you will need to do 2 things:
1) change your ODS LISTING statement to have a full path AND filename reference
and
2) investigate the option that puts a "page break" between each procedure output. For the LISTING destination, I believe it is the FORMDLIM or FORMDLM option. you'll have to look it up. (Right now, you are getting the default "carriage control" character inserted at the beginning of every procedure and you need to find the system option that will turn this off.)

cynthia

by full path and extension I mean that you need to change this to:
ods listing file = 'c:\myfile\report.lst'; OR
ods listing file = 'c:\myfile\report.txt';
... your code;
ods listing close;

View solution in original post

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi:
I'm not sure why you need to produce this type of report in text file (which is what LISTING output is). It looks like a standard demographic report and most of my students use either PDF or RTF for this report type.

However, if you want to send output to the LISTING destination, specifically to a file, then you will need to do 2 things:
1) change your ODS LISTING statement to have a full path AND filename reference
and
2) investigate the option that puts a "page break" between each procedure output. For the LISTING destination, I believe it is the FORMDLIM or FORMDLM option. you'll have to look it up. (Right now, you are getting the default "carriage control" character inserted at the beginning of every procedure and you need to find the system option that will turn this off.)

cynthia

by full path and extension I mean that you need to change this to:
ods listing file = 'c:\myfile\report.lst'; OR
ods listing file = 'c:\myfile\report.txt';
... your code;
ods listing close;

bobbee
Calcite | Level 5

Thank you. It realy helped me.

Ksharp
Super User
You can use simple Data Step to get it .

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 3 replies
  • 1754 views
  • 1 like
  • 3 in conversation