Your SAS programs, embedded in web apps and elsewhere

Link in Storedproc

Reply
SAS Employee
Posts: 2

Link in Storedproc

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
Ask a Question
Discussion stats
  • 0 replies
  • 199 views
  • 0 likes
  • 1 in conversation