I need to count how many observations fit on page in proc report. How to compute variable pagenum (e.g.) which consists page number?
Logic of this procedure (in pseudocode) is following:
L - number of rows per page
pagenum = 1
counter = 0
for observation in dataset: #go through all observations in dataset
counter += HowManyRows(observation) #HowManyRows function returns number of rows which observation deposite on page
if counter <= L*pagenum then:
pagenum #write value pagenum into pagenum variable in datastep
else:
pagenum = pagenum + 1 #write value pagenum into pagenum variable in datastep
How to write similar logic in SAS?
At the end I'll obtain datastep with pagenum variable and I can write line statments before every page. Last question: does this line shift page content by 1 row and the last page row transfers to the next page?