Observation Number Column and Columns Cut Off

#1
I am new with SAS and have two problems that I need help with. (Problem 1 is solved just problem 2 left)
1.) The OBS column only prints out number corresponding to the record number the observations are found.
Example:
Obs
311
331
352
I would like to have a column that prints out number starting from 1
Obs
1
2
3


2.) Because I have so many columns, when I print out the report or do a print preview, some columns on the right hand side gets cut off like the date would get chopped off. Because I have so many columns I was wondering how to adjust the page when I print the report so nothing would get cut off.
This is the code:
proc print data=check_nodup;
TITLE2 'Check MDOB across all booklets and tables';
var id DOB_randtime DOB_sal DOB_pat DOB_patdat DOB_en2 DOB_en3 DOB_en4 DOB_cont2 DOB_DOB_cont3
DOB_DOB_cont4 DOB_DOB_cont5 DOB_DOB_cont6 DOB_DOB_cont7 DOB_DOB_cont8 DOB_del2 DOB_del3
DOB_mat2 DOB_mat3 DOB_mat4 DOB_mat5 DOB_mat6 DOB_mat7 DOB_neo2 DOB_neo3 DOB_neo4 DOB_neo5 DOB_neo6
DOB_neo7 DOB_supdoc DOB_ques2 DOB_ques3 DOB_ques4 DOB_ques5 DOB_DOB_ques6 DOB_ques7 DOB_ques8;
where all_match=0;
run;
 
Last edited:
#3
Hi I did what the person replied and I got the same problem. Sorry I am really new with SAS and it doesn't help I am editing someone else's code. Is easier if I have a sample code to look at.

proc sort data=check out=check_nodup nodups;
by id;
run;

Data temp;
set check_nodup;
counter=_n_;
run;

proc print data=temp noobs;
TITLE2 'Check MDOB across all booklets and tables';
var counter id DOB_randtime DOB_sal DOB_pat DOB_patdat DOB_en2 DOB_en3 DOB_en4 DOB_cont2 DOB_DOB_cont3
DOB_DOB_cont4 DOB_DOB_cont5 DOB_DOB_cont6 DOB_DOB_cont7 DOB_DOB_cont8 DOB_del2 DOB_del3
DOB_mat2 DOB_mat3 DOB_mat4 DOB_mat5 DOB_mat6 DOB_mat7 DOB_neo2 DOB_neo3 DOB_neo4 DOB_neo5 DOB_neo6
DOB_neo7 DOB_supdoc DOB_ques2 DOB_ques3 DOB_ques4 DOB_ques5 DOB_DOB_ques6 DOB_ques7 DOB_ques8;
where all_match=0
;
run;
 
#4
here's one with the counter I still got the same error.

proc sort data=check out=check_nodup nodups;
by id;
run;

Data temp;
set check_nodup;
run;

options orientation=landscape;
proc print data=temp;
TITLE2 'Check MDOB across all booklets and tables';
var id DOB_randtime DOB_sal DOB_pat DOB_patdat DOB_en2 DOB_en3 DOB_en4 DOB_cont2 DOB_DOB_cont3
DOB_DOB_cont4 DOB_DOB_cont5 DOB_DOB_cont6 DOB_DOB_cont7 DOB_DOB_cont8 DOB_del2 DOB_del3
DOB_mat2 DOB_mat3 DOB_mat4 DOB_mat5 DOB_mat6 DOB_mat7 DOB_neo2 DOB_neo3 DOB_neo4 DOB_neo5 DOB_neo6
DOB_neo7 DOB_supdoc DOB_ques2 DOB_ques3 DOB_ques4 DOB_ques5 DOB_DOB_ques6 DOB_ques7 DOB_ques8;
where all_match=0
;
run;
 

SPR

New Member
#5
Hello Janoose,

I think you can simply subset the dataset you print and use several proc PRINT steps. For example, let dataset a has variables named id, A, B, C,... Z then you can use the following code:

proc print data=a labels;
id ID;
var A--F;
run;

proc print data=a labels;
id ID;
var G--N;
run;

etc.

Ranges of variables names should be such that each print output fits one page.

Sincerely,
SPR