The SAS Output Delivery System and reporting techniques

Why Proc report produces only 1 record in output and Proc print produces all 10 observations

Accepted Solution Solved
Reply
Contributor
Posts: 51
Accepted Solution

Why Proc report produces only 1 record in output and Proc print produces all 10 observations

Hi there,

Simple question.

I have dataset which contains 10 observations.

I am using ODS PDF to create PDF file.

OPTIONS ORIENTATION=landscape NODATE papersize=A1 linesize=max pagesize=max leftmargin=0.5in NODATE NOCENTER MISSING=" "
formchar="|----|+|---+=|-/\<>*";

ods pdf file="&path..pdf";

proc report data=work.output;

run;

ods pdf close;

 

this produces only 1 observation. However when I use proc print it correctly produces 10 records. what could be the issue? Any help is really appreciated


Accepted Solutions
Solution
‎12-09-2017 12:07 AM
SAS Super FREQ
Posts: 8,958

Re: Why Proc report produces only 1 record in output and Proc print produces all 10 observations

Hi:

  I am guessing you are seeing something like #1 vs #2 in the screen shot below:possible_report_solution.png

 

Here's the test code.

 

data testdata;
  infile datalines;
  input id amount;
datalines;
100 15
200 22
300 35
400 41
500 58
;
run;
 
proc print data=testdata;
  title '1) with a PROC PRINT detail report you see all 5 obs';
run;
 
proc report data=testdata;
  title '2) with all numeric variables, the PROC REPORT default';
  title2 'is to summarize -- so you only see 1 row';
run;
 
proc report data=testdata;
  title '3) To see detailed rows with PROC REPORT, provide a usage for numeric variables';
  column id amount;
  define id / order;
  define amount / sum;
run;

 

My guess is you need to switch to code like #3 report and provide a usage for a numeric variable or you need to add a GROUP or ORDER variable to the PROC REPORT code.

 

cynthia

View solution in original post


All Replies
Super User
Posts: 20,730

Re: Why Proc report produces only 1 record in output and Proc print produces all 10 observations

Posted in reply to yashpande

Please include your log in the post. 

Contributor
Posts: 51

Re: Why Proc report produces only 1 record in output and Proc print produces all 10 observations

Below is log when using Proc report

24
25 GOPTIONS ACCESSIBLE;
26
27 OPTIONS ORIENTATION=landscape NODATE papersize=A1 linesize=max pagesize=max leftmargin=0.5in NODATE NOCENTER MISSING=" "
28 formchar="|----|+|---+=|-/\<>*";
29 ods pdf file="&path..pdf";
NOTE: Writing ODS PDF output to DISK destination "/data/Comparison.pdf.pdf", printer "PDF".
30 proc report data=work.output;
31 run;

NOTE: There were 24 observations read from the data set WORK.OUTPUT.
NOTE: PROCEDURE REPORT used (Total process time):
real time 0.02 seconds
cpu time 0.03 seconds

32 ods pdf close;
NOTE: ODS PDF printed 1 page to /data/Comparison.pdf.pdf.

 

And below is using Proc print

 

25 GOPTIONS ACCESSIBLE;
26 OPTIONS ORIENTATION=landscape NODATE papersize=A1 linesize=max pagesize=max leftmargin=0.5in NODATE NOCENTER MISSING=" "
27 formchar="|----|+|---+=|-/\<>*";
28 ods pdf file="&path..pdf";
NOTE: Writing ODS PDF output to DISK destination "/data/Comparison.pdf.pdf", printer "PDF".
29 proc print data=work.output;
30 run;

NOTE: There were 24 observations read from the data set WORK.OUTPUT.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.05 seconds
cpu time 0.05 seconds

31 ods pdf close;
NOTE: ODS PDF printed 1 page to /data/Comparison.pdf.pdf.

 

 

Super User
Posts: 20,730

Re: Why Proc report produces only 1 record in output and Proc print produces all 10 observations

Posted in reply to yashpande

They both show 24 records read. Can you please re-run that with a SASHELP dataset, such as CARS and post the PDF/HTML that's truncated and the log. 

 

If the issue isnt replicated with a SASHELP data set then it's likely an issue with the data somehow.

 

Solution
‎12-09-2017 12:07 AM
SAS Super FREQ
Posts: 8,958

Re: Why Proc report produces only 1 record in output and Proc print produces all 10 observations

Hi:

  I am guessing you are seeing something like #1 vs #2 in the screen shot below:possible_report_solution.png

 

Here's the test code.

 

data testdata;
  infile datalines;
  input id amount;
datalines;
100 15
200 22
300 35
400 41
500 58
;
run;
 
proc print data=testdata;
  title '1) with a PROC PRINT detail report you see all 5 obs';
run;
 
proc report data=testdata;
  title '2) with all numeric variables, the PROC REPORT default';
  title2 'is to summarize -- so you only see 1 row';
run;
 
proc report data=testdata;
  title '3) To see detailed rows with PROC REPORT, provide a usage for numeric variables';
  column id amount;
  define id / order;
  define amount / sum;
run;

 

My guess is you need to switch to code like #3 report and provide a usage for a numeric variable or you need to add a GROUP or ORDER variable to the PROC REPORT code.

 

cynthia

Contributor
Posts: 51

Re: Why Proc report produces only 1 record in output and Proc print produces all 10 observations

Posted in reply to Cynthia_sas

Perfect. All columns are numeric ...And thats why this problem. Thanks a lot

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 173 views
  • 0 likes
  • 3 in conversation