BookmarkSubscribeRSS Feed
yamatazan
SAS Employee

Hi expert,

I have some inquiries regarding creating an link in report.

I am creating an stored proc that will link and view the pdf
file that resides in the server.

I have this code:

libname
SRC
"/DW82TEMP/RELIEF_2010/LETTERS/RDO001";

%let
SRC = /DW82TEMP/RELIEF_2010/LETTERS/RDO001;

%put
&SRC;

DATA
WORK.TEMP;

     INFILE "&SRC./list.txt"

        
DELIMITER=
'09'x

         MISSOVER

           DSD

  ;

     LENGTH

      
FILES $
200

;

   INPUT

      
FILES $

;

  LABEL

        
FILES =
"FILES"

;

RUN;

data
temp2;

   set temp;

  
FILENAME = compress(
"No" || "."
|| left(_n_) ||
"-" ||tranwrd(FILES,".pdf","
"
));

run;

data_null_;

    set
temp2 end=last;

     call
symput(compress(
"NO"),compress("No"
||
"." || left(_n_) || "-"
||tranwrd(FILES,
".pdf","
"
)));

     if
last
then call symput("Obs",_n_);

  run;

   procsql;

     select count(*) into:CNTfrom work.temp2;

  quit;

  

%put
&CNT;

 

data_null_;

call
symput(
"C", compress("CTR"||&CNT));

  call
symput(
"F", compress("F"||&CNT));

run;

  %put
&C &F;

procsql noprint;

      select FILENAME into
:CTR1 - :&C
from work.temp2;


  
select FILES into
:F1 - :&F
from work.temp2;

  quit;

%macro
cnt;

   %do  i=1%to &CNT;

          %put &&CTR&i;

           %put &&F&i;

     %end;

%mend;

  %cnt;

%macro
files;

     %if &CNT > 0%then %do;

          %put 'PASOK';

        
data _null_;

       
file
"/export/home/sasguest/_webout.dat";

         %put '<HTML>';

           %put '<H1>LIST OF LN under RDO 001
</H1>';

         %put;

/*        
%put '<BODY vlink="#004488" link="#0066AA">
bgcolor="#E0E0E0">';*/

           %do i=1%to &CNT;

                 %put '<UL>';

                
length nexturl $
500;

          nexturl = symget('_THISSESSION')
||
'&_PROGRAM=/DW82TEMP/RELIEF_2010/LETTERS/RDO001/'

/*                    
  || '&&CTR&i;=' ||
urlencode("&&CTR&i;");*/

                 
  || urlencode(
"&&F&i;");

                    %put '<LI><A HREF="' nexturl
+(-1)'&&F&i"> &&CTR&i </A></LI>';

                 %put '</UL>';

/*              
%put '</BODY>';*/

                %put '</HTML>';

           %end;

      
run;

     %end;

     %else %do;

           %put 'WALA';

     %end;

     %put &CNT;

  

%mend
files;

 

%files;

    Is this correct?


server.jpg

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 0 replies
  • 621 views
  • 0 likes
  • 1 in conversation