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.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
  • 0 replies
  • 656 views
  • 0 likes
  • 1 in conversation