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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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