Community talk about Meta!

bookmarking the page numbers in external file

Occasional Contributor
Posts: 16

bookmarking the page numbers in external file

[ Edited ]



Can you please help me in figuring out the code for below scenario.


I have a variable with pagenumbers. I want these numbers to be hyperlinked to an external file. When there are one page numebr in the variable then there are no issues. But when there are multiple page numbers not sure how to code it.


12, 15
8, 14, 20, 30, 32, 35





if index(pages,',')=0 then pg_=strip(pages);
else if index(pages,',') then do;
    pg_=substr(pages, 1, index(pages,','));
    pg1_= substr(pages,index(pages,',')+1);
if pages ne '' and index(pages, ',')=0 then origin = '{CRF {\field {\*\fldinst HYPERLINK "\\blankcrf.pdf#page=' ||
trim(left(pg_)) || '"}{\fldrslt {\cs15\cf2 Page ' || trim(left(pg_)) || '}}}}';
else if pages ne '' and countc(pages, ',')=1 then origin = '{CRF {\field {\*\fldinst HYPERLINK "\\blankcrf.pdf#page=' ||
trim(left(pg_)) || '"}{\fldrslt {\cs15\cf2 Pages ' || trim(left(pg_)) || '}}}}' ||'{{\field {\*\fldinst HYPERLINK "\\blankcrf.pdf#page=' ||
trim(left(pg1_)) || '"}{\fldrslt {\cs15\cf2 ' || trim(left(pg1_)) || '}}}}';
else if pages ne '' and countc(pages, ',') gt 1 then origin='{Multiple CRF {\field {\*\fldinst HYPERLINK "\\blankcrf.pdf#page=1"}{\fldrslt {\cs15\cf2 Pages}}}}';


Can anyone help me in looping it n number of times based on the page numbers so that all the pages can be hyperlinked and I can replace the "Multiple CRF" value when there are more than two pages in the pages variable.



Thank You for your time.

Super User
Super User
Posts: 7,401

Re: bookmarking the page numbers in external file

I would advise you simplfy your question as I really don't want to start looking through RTF code and such like.  If you want to loop over those values, then use a do loop (and maybe an array if necessary) e.g;

data want;
  do i="14","12, 15","8, 14, 20, 30, 32, 35"; something here e.g...
    page="Some page number="||strip(i);
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation