24.04.2014 Views

Pratique de Sas Windows ...9.3 Volume 2 - Ined

Pratique de Sas Windows ...9.3 Volume 2 - Ined

Pratique de Sas Windows ...9.3 Volume 2 - Ined

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.3.3 Deux possibilités à creuser : Proc fcmp et Proc http<br />

2.3.3.1 Fcmp<br />

Cette procédure permettant <strong>de</strong> dépasser les limites <strong>de</strong> l’encapsulation link/return dans l’étape data et permettant<br />

la création <strong>de</strong> nouvelles fonctions ou subroutines, a évolué <strong>de</strong>puis (V1_p195-196). Des nouveautés intéressantes<br />

ont été présentées en 2.2.3. Contentons-nous <strong>de</strong> renvoyer à <strong>de</strong>s textes intéressants pour rappel :<br />

- « Functioning at an Advanced Level: PROC FCMP and PROC PROTO» Peter Eberhardt<br />

http://support.sas.com/resources/papers/proceedings10/024-2010.pdf<br />

et pour approfondissement :<br />

- «The new <strong>Sas</strong> 9.2 FCMP Procedure, what functions are in your future?» John H. Adams<br />

http://www.lexjansen.com/pharmasug/2010/ad/ad02.pdf<br />

- http://www.statsblogs.com/2012/04/18/extending-<strong>Sas</strong>-how-to-<strong>de</strong>fine-new-functions-in-proc-fcmp-and-<br />

<strong>Sas</strong>iml-software/ <strong>de</strong> Rick Wilkin<br />

- http://www.ama<strong>de</strong>us.co.uk/<strong>Sas</strong>-technical-services/tips-and-techniques/general/removing-unwantedcharacters-from-text-strings/<br />

chez Ama<strong>de</strong>us en 2011<br />

Et cette trouvaille très intéressante du Macro Function Sandwich <strong>de</strong> Mike Rhoads -à lire-<br />

- « Use the Full Power of <strong>Sas</strong>® in Your Function-Style Macros» Mike Rhoads<br />

http://support.sas.com/resources/papers/proceedings12/004-2012.pdf reprise aussi sur le site <strong>Sas</strong><br />

http://www.sas.com/success/westat-tech-case-study.html<br />

2.3.3.2 Dropbox (ou googledoc, skydrive, etc) et proc http<br />

Il est intéressant <strong>de</strong> découvrir avec Chris Hemedinger une manière <strong>de</strong> lire sur le Cloud<br />

(http://blogs.sas.com/content/<strong>Sas</strong>dummy/2012/12/18/using-<strong>Sas</strong>-to-access-data-stored-on-dropbox/ )<br />

En voici un petit exemple pour la boite du chercheur habitué à :<br />

On va sur sa boîte en ligne et sur le fichier visé on actionne<br />

ce qui vous mènera à<br />

Avec récupération d’une adresse <strong>de</strong> lien qui se met en presse-papier et à modifier à la marge www <strong>de</strong>vient dl<br />

https://www.dropbox.com/s/252ixxm7x35bxxw/data.txt<br />

filename _inbox "%sysfunc(getoption(work))/data.txt";<br />

proc http method="get"<br />

url="https://dl.dropbox.com/s/252ixxm7x35bxxw/data.txt"<br />

out=_inbox ;<br />

run;<br />

data lecture;<br />

infile _inbox dlm=': ' truncover;<br />

input numer id1 val1 id2 val2 id3 val3 id4 val4 id5 val5 id6 val6 id7 val7<br />

id8 val8 id9 val9 id10 val11 id11 val11 b c;<br />

run;<br />

filename _inbox clear;<br />

NOTE: The infile _INBOX is:<br />

Nom du fichier=d:\My <strong>Sas</strong> Files\work\_TD1756_PC_01180_\data.txt,<br />

RECFM=V,LRECL=256,<br />

Taille <strong>de</strong> fichier (octets)=974,<br />

Modifié(e) le=14 janvier 2013 16 h 23,<br />

Heure <strong>de</strong> création=14 janvier 2013 16 h 23<br />

NOTE: 8 records were read from the infile _INBOX.<br />

The minimum record length was 112.<br />

The maximum record length was 124.<br />

NOTE: The data set WORK.LECTURE has 8 observations and 24 variables.<br />

NOTE: L'étape DATA used (Total process time):<br />

real time<br />

0.01 secon<strong>de</strong>s<br />

cpu time<br />

0.03 secon<strong>de</strong>s<br />

30 filename _inbox clear;<br />

NOTE: Fileref _INBOX has been <strong>de</strong>assigned.<br />

La même technique s’appliquera pour une table <strong>Sas</strong> et il sera même possible <strong>de</strong> <strong>de</strong>scendre du nuage un<br />

programme <strong>Sas</strong> bien réel et l’insérer dans le program editor par un %inclu<strong>de</strong> _inbox ; avant le filename clear.<br />

62 <strong>Pratique</strong> <strong>de</strong> <strong>Sas</strong> windows ….93 <strong>Volume</strong> 2 et Coll.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!