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

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;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

5 REPLIES 5
ballardw
Super User

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.

Cynthia_sas
SAS Super FREQ

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

ADouglas
Obsidian | Level 7

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

ballardw
Super User

@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.

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!

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
  • 5 replies
  • 1970 views
  • 0 likes
  • 3 in conversation