The table produced has many columns. Is there a way to display a pdf where the first 4 columns are repeated in all pages? There are many more columns after position and many more rows. I have the following code but it is not working:
data sample;
input ID $ Name $ Age Salary Department $ Position $;
datalines;
1 John 30 50000 HR Manager
2 Jane 25 55000 Finance Analyst
3 Jack 40 60000 IT Developer
4 Jill 35 62000 Marketing Specialist
;
run;
ods pdf file='C:\path\to\your\output.pdf';
proc report data=sample nowd split='_';
column ID Name Age Salary Department Position;
define ID / 'ID' left;
define Name / 'Name' left;
define Age / 'Age' center;
define Salary / 'Salary' right;
define Department / 'Department' left;
define Position / 'Position' left;
/* Specify the columns to be repeated */
compute after _page_;
line ' ';
line 'ID Name Age Salary';
endcomp;
run;
/* Close ODS PDF destination */
ods pdf close;
Using ID + PAGE option :
data sample;
input ID $ Name $ Age Salary Department $ Position $;
datalines;
1 John 30 50000 HR Manager
2 Jane 25 55000 Finance Analyst
3 Jack 40 60000 IT Developer
4 Jill 35 62000 Marketing Specialist
;
run;
ods pdf file='C:\temp\output.pdf';
proc report data=sample nowd split='_';
column ID Name Age Salary Department Position;
define ID / 'ID' left ;
define Name / 'Name' left ID ;
define Age / 'Age' center;
define Salary / 'Salary' right;
define Department / 'Department' left PAGE;
define Position / 'Position' left;
/* Specify the columns to be repeated */
compute after _page_;
line ' ';
line 'ID Name Age Salary';
endcomp;
run;
/* Close ODS PDF destination */
ods pdf close;
Using ID + PAGE option :
data sample;
input ID $ Name $ Age Salary Department $ Position $;
datalines;
1 John 30 50000 HR Manager
2 Jane 25 55000 Finance Analyst
3 Jack 40 60000 IT Developer
4 Jill 35 62000 Marketing Specialist
;
run;
ods pdf file='C:\temp\output.pdf';
proc report data=sample nowd split='_';
column ID Name Age Salary Department Position;
define ID / 'ID' left ;
define Name / 'Name' left ID ;
define Age / 'Age' center;
define Salary / 'Salary' right;
define Department / 'Department' left PAGE;
define Position / 'Position' left;
/* Specify the columns to be repeated */
compute after _page_;
line ' ';
line 'ID Name Age Salary';
endcomp;
run;
/* Close ODS PDF destination */
ods pdf close;
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.
Ready to level-up your skills? Choose your own adventure.