The SAS Output Delivery System and reporting techniques

How can I insert a page number in my DATA step file print report?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

How can I insert a page number in my DATA step file print report?

Hello,

 

I would like to insert a page number in my file print report that I create with a DATA step. Below is my code. Can someone please explain to me how to do it? Thank you, Aaron.

 

options missing='-';

title "Item Analysis Report for &FORM that has &NUMBER MCQs.";

DATA SCORED.&FORM.Combined_Statistics_R;

SET SCORED.&FORM.Combined_Statistics_R (RENAME=(Key_char=Key));

drop PValue_M Mean_Score_M PT_Biserial_M;

file print header=H linesleft=remain pagesize=90;

if remain<17 then put _page_ ;

PUT @1 "Item Number:" @14 seq @20 "Accession Number:" @38 ACN @55 "N of Response Opts:" @75 Number_of_Options/

@4 "Correct Answer:" @20 Key/

@4 'P Value:' @13 pvalue @21 'Pt Biserial:' @34 Pt_Biserial @42 "Bench Item Delta:" @60 Bench_Item_Delta //

@10 'Response Opt:' @30 "A" @40 "B" @50 "C" @60 "D" @70 "E" @80 "Missing" @90 'Total N of PPL'/

@10 'N of PPL:' @30 N_of_ppl_A @40 N_of_ppl_B @50 N_of_ppl_C @60 N_of_ppl_D @70 N_of_ppl_E @80 N_of_ppl_M @90 Total_N/

@10 'Opt P Value:' @30 PValue_A @40 PValue_B @50 PValue_C @60 PValue_D @70 PValue_E @80 /

@10 'Pt Biserial:' @30 PT_Biserial_A @40 PT_Biserial_B @50 PT_Biserial_C @60 PT_Biserial_D @70 PT_Biserial_E @80 /

@10 'Mean Score:' @30 Mean_Score_A @40 Mean_Score_B @50 Mean_Score_C @60 Mean_Score_D @70 Mean_Score_E @80 //

@4 "NOTE: For response options no examinee selects, a dash '-' is displayd for the Pt Biserial." /

@4 "NOTE: For a not permitted response option, a dash '-' is displayed for all item statistics."//;

return;

H: Put @1 "Item Analysis, &FORM, &NUMBER MCQs."/

@1 "Run Date: %sysfunc(date(),date9.)"/

@1 "Run Time: %sysfunc(time(),tod8.)"/;

RUN;

options missing='.';

title;


Accepted Solutions
Solution
‎05-18-2017 07:44 AM
Super User
Posts: 11,118

Re: How can I insert a page number in my DATA step file print report?

Maybe some thing like this:

missing='-';
title "Item Analysis Report for &FORM that has &NUMBER MCQs.";
DATA SCORED.&FORM.Combined_Statistics_R; 
SET SCORED.&FORM.Combined_Statistics_R (RENAME=(Key_char=Key));
drop PValue_M Mean_Score_M PT_Biserial_M;
file print header=H linesleft=remain pagesize=90;
/* Establish a counter variable*/
Retain PageCount 1;
if remain<17 then do;
   /*assuming this IF to page the file*/
   Put Pagecount;
   put _page_ ;
   /*increment the counter after printing*/
   PageCount+1;
End;
PUT @1 "Item Number:" @14 seq @20 "Accession Number:" @38 ACN @55 "N of Response Opts:" @75 Number_of_Options/
@4 "Correct Answer:" @20 Key/
@4 'P Value:' @13 pvalue @21 'Pt Biserial:' @34 Pt_Biserial @42 "Bench Item Delta:" @60 Bench_Item_Delta //
@10 'Response Opt:' @30 "A" @40 "B" @50 "C" @60 "D" @70 "E" @80 "Missing" @90 'Total N of PPL'/
@10 'N of PPL:' @30 N_of_ppl_A @40 N_of_ppl_B @50 N_of_ppl_C @60 N_of_ppl_D @70 N_of_ppl_E @80 N_of_ppl_M @90 Total_N/ 
@10 'Opt P Value:' @30 PValue_A @40 PValue_B @50 PValue_C @60 PValue_D @70 PValue_E @80 /
@10 'Pt Biserial:' @30 PT_Biserial_A @40 PT_Biserial_B @50 PT_Biserial_C @60 PT_Biserial_D @70 PT_Biserial_E @80 /
@10 'Mean Score:' @30 Mean_Score_A @40 Mean_Score_B @50 Mean_Score_C @60 Mean_Score_D @70 Mean_Score_E @80 //
@4 "NOTE: For response options no examinee selects, a dash '-' is displayed for the Pt Biserial." /
@4 "NOTE: For a not permitted response option, a dash '-' is displayed for all item statistics."//;
return;
H: Put @1 "Item Analysis, &FORM, &NUMBER MCQs."/
@1 "Run Date: %sysfunc(date(),date9.)"/
@1 "Run Time: %sysfunc(time(),tod8.)"/;
RUN; 
options missing='.';
title;

Without data there is not way to actually test this.

 

Corrected a spelling for "displayd" in the for Pt  Biserial line.

View solution in original post


All Replies
Solution
‎05-18-2017 07:44 AM
Super User
Posts: 11,118

Re: How can I insert a page number in my DATA step file print report?

Maybe some thing like this:

missing='-';
title "Item Analysis Report for &FORM that has &NUMBER MCQs.";
DATA SCORED.&FORM.Combined_Statistics_R; 
SET SCORED.&FORM.Combined_Statistics_R (RENAME=(Key_char=Key));
drop PValue_M Mean_Score_M PT_Biserial_M;
file print header=H linesleft=remain pagesize=90;
/* Establish a counter variable*/
Retain PageCount 1;
if remain<17 then do;
   /*assuming this IF to page the file*/
   Put Pagecount;
   put _page_ ;
   /*increment the counter after printing*/
   PageCount+1;
End;
PUT @1 "Item Number:" @14 seq @20 "Accession Number:" @38 ACN @55 "N of Response Opts:" @75 Number_of_Options/
@4 "Correct Answer:" @20 Key/
@4 'P Value:' @13 pvalue @21 'Pt Biserial:' @34 Pt_Biserial @42 "Bench Item Delta:" @60 Bench_Item_Delta //
@10 'Response Opt:' @30 "A" @40 "B" @50 "C" @60 "D" @70 "E" @80 "Missing" @90 'Total N of PPL'/
@10 'N of PPL:' @30 N_of_ppl_A @40 N_of_ppl_B @50 N_of_ppl_C @60 N_of_ppl_D @70 N_of_ppl_E @80 N_of_ppl_M @90 Total_N/ 
@10 'Opt P Value:' @30 PValue_A @40 PValue_B @50 PValue_C @60 PValue_D @70 PValue_E @80 /
@10 'Pt Biserial:' @30 PT_Biserial_A @40 PT_Biserial_B @50 PT_Biserial_C @60 PT_Biserial_D @70 PT_Biserial_E @80 /
@10 'Mean Score:' @30 Mean_Score_A @40 Mean_Score_B @50 Mean_Score_C @60 Mean_Score_D @70 Mean_Score_E @80 //
@4 "NOTE: For response options no examinee selects, a dash '-' is displayed for the Pt Biserial." /
@4 "NOTE: For a not permitted response option, a dash '-' is displayed for all item statistics."//;
return;
H: Put @1 "Item Analysis, &FORM, &NUMBER MCQs."/
@1 "Run Date: %sysfunc(date(),date9.)"/
@1 "Run Time: %sysfunc(time(),tod8.)"/;
RUN; 
options missing='.';
title;

Without data there is not way to actually test this.

 

Corrected a spelling for "displayd" in the for Pt  Biserial line.

SAS Super FREQ
Posts: 8,819

Re: How can I insert a page number in my DATA step file print report?

Hi:

  You do NOT show your options, but I wonder why you are not using the simple options for inserting a page number. For example, in a much simplifed version of your program that only writes out from SASHELP.SHOES:

options_number.png

 

And even if you do not want to print your FILE PRINT report from the OUTPUT window, you can use the FILE= option of ODS LISTING to make an ASCII text file that contains "page feeds" and page numbers, as shown here:

use_ods_listing_page_numbers_in_file.png

 

the options number/nonumber and pageno= have been around for quite some time. I wouldn't expect you have to do your own page numbering under most circumstances.

 

cynthia

Occasional Contributor
Posts: 7

Re: How can I insert a page number in my DATA step file print report?

Thanks, but although it leads to page numbers, it doesn't provide the kind of solution I want.

Super User
Posts: 11,118

Re: How can I insert a page number in my DATA step file print report?


ADouglas wrote:

Thanks, but although it leads to page numbers, it doesn't provide the kind of solution I want.


When providing a short answer like that you may want to consider using the QUOTE button at the upper right of the message entry window so that we know which solution, question or comment you are addressing.

Occasional Contributor
Posts: 7

Re: How can I insert a page number in my DATA step file print report?

Thanks. This worked.

☑ This topic is solved.

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

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