Type : MIXTE
Utilise des données définies en dur (datalines/cards4 via la macro AHG2arr) et les métadonnées de session SAS (sashelp.vlibnam).
| 1 | %macro message_js(pre,file=) ; |
| 2 | |
| 3 | DATA _null_ ; |
| 4 | file "&file"; |
| 5 | put "&html1"; |
| 6 | put "&html2"; |
| 7 | put "&html3"; |
| 8 | %local i J one; |
| 9 | %DO j=1 %to %AHGcount(&pre); |
| 10 | %let one=%scan(&pre,&j,%str( )); |
| 11 | %IF not %symexist(&one._n) %THEN |
| 12 | %DO; |
| 13 | %IF %bquote(%sysfunc(rank(%substr(%bquote(&&&one),1,1))))=34 |
| 14 | or %bquote(%sysfunc(rank(%substr(%bquote(&&&one),1,1))))=39 %THEN put %unquote(&&&one); |
| 15 | %ELSE put "%unquote(&&&one)"; |
| 16 | %END; |
| 17 | %ELSE |
| 18 | %DO i=1 %to &&&one._n; |
| 19 | %put ############### &&&one&i; |
| 20 | %IF %bquote(%sysfunc(rank(%substr(%bquote(&&&one&i),1,1))))=34 |
| 21 | or %bquote(%sysfunc(rank(%substr(%bquote(&&&one&i),1,1))))=39 %THEN put %unquote(&&&one&i); |
| 22 | %ELSE put "%unquote(&&&one&i)"; |
| 23 | ; |
| 24 | put; |
| 25 | %END; |
| 26 | %END; |
| 27 | put "&html4"; |
| 28 | put "&html5"; |
| 29 | RUN ; |
| 30 | |
| 31 | x "start &file"; |
| 32 | %mend message_js ; |
| 33 | option mprint; |
| 1 | %AHGdel(html,like=1); |
| 2 | |
| 3 | %AHG2arr(html); |
| 4 | cards4; |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | ;;;; |
| 11 | RUN; |
| 12 | |
| 13 | %AHG2arr(btn); |
| 14 | cards4; |
| 15 | 'c:\temp\ahuige'>dd |
| 16 | ;;;; |
| 17 | RUN; |
| 18 | |
| 19 | %let alink='c:\temp\ahuige'>c; |
| 1 | %AHGdel(url,like=1); |
| 2 | |
| 3 | PROC SQL; |
| 4 | create TABLE html as |
| 5 | select '''<a href="'||trim(path)||'">'||compress(LIBNAME)||'</a>''' as url |
| 6 | from sashelp.vlibnam |
| 7 | WHERE not LIBNAME in ( 'SASHELP','SASUSER','MAPS'); |
| 8 | ; |
| 9 | QUIT; |
| 1 | DATA _null_; |
| 2 | SET html; |
| 3 | call symput('url'||%AHGputN(_n_,BEST.),TRIM(url)); |
| 4 | call symput('url_N',_N_); |
| 5 | RUN; |
| 6 | |
| 7 | %AHGpmlike(url); |
| 1 | %macro dosomething(arr); |
| 2 | %AHGdel(&arr,like=1); |
| 3 | %local i j all; |
| 4 | %IF %symexist(__snapshot) %THEN |
| 5 | %DO; |
| 6 | %let all= programs_stat replica_programs ; |
| 7 | %let j=0; |
| 8 | %DO i=1 %to %AHGcount(&all); |
| 9 | %PUT GREAT &I; |
| 10 | %IF %sysfunc(fileexist(&__snapshot\%scan(&all,&i,%str( )))) %THEN |
| 11 | %DO; |
| 12 | %AHGincr(j); |
| 13 | %let &arr&j=%bquote('<a href="&__snapshot\%scan(&all,&i,%str( ))">%scan(&all,&i,%str( ))</a>'); |
| 14 | %AHGpm(&arr&j); |
| 15 | %LET &ARR._N=&j; |
| 16 | %END; |
| 17 | %END; |
| 18 | |
| 19 | %END; |
| 20 | |
| 21 | %message_js(URL btn alink %IF %symexist(__snapshot) %THEN &arr;,file=%AHGtempdir\js.html); |
| 22 | /*&arr*/ |
| 23 | %mend; |
| 24 | %doSomething(APATH33); |