BookmarkSubscribeRSS Feed
Daya87
Calcite | Level 5

HI All, 

 

  Please help me on this.

 

 I have dataset with a variable name.

 

  NAME

  Alice

 James

 Jeffrey

 Joyce

 Barbara

 

The above given observation's present in a PDF document. 1. Alice present in page number 4 and 5.

                                                                                                2. James present in page number 3

                                                                                               3. Jeffrey present in page number 1, 2 and 3

                                                                                               4. Joyce present in page number  2 and 3

                                                                                               5. Barbara present in page number  1

So i want an output dataset like

 

  NAME       NUMBER  

   Alice        4, 5 

  James      3 

  Jeffrey     1,  2,  3 

  Joyce       2,  3 

  Barbara   1

 

Note:- If more than one page number , should be seperated with ", " in output.

 

Thanks in Advance.

 

Regards

Daya

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

There is no way to know up front how PDF will render the document.  I have seen floating around the internet some very long and complicated code which attempts to guess, but even then they are only right half the time.  I would suggest you evaluate your data before outputting.  This can take many methods, som examples:

- Assume each data row is one row on the output, then divide _n_ by the number you want on each page, e.g:
data want;

  set have;

  pge=ceil(_n_/20);

run;

This will give you a variable with page numbers, then in your proc report your break on PGE variable.  You can make that more or less complicated as you wish.

However why have a list of pages?  It doesn't sound that normal to me.  I tend to always see page number, and sometimes total pages - which is why the renderer code ^{thispage} of ^{lastpage} is given so you can let the software which renders the output (PDF, RTF etc.) decide on page numbering.  At the end of the day page numbering is only there to check you have a complete output, any logical test should be done on the data not on where it appears in output?

Ksharp
Super User

If your REPORT was  simple, you can count how many rows in every page there were by hand.

Once you get that NUMBER, you can easily get who belong to which page .

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