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
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
2.4.4.1 MAUTOLOCINDES<br />
Cette option système a pour effet d’aller compiler une macro autocall <strong>de</strong> <strong>Sas</strong> dans le catalogue work.sasmacr<br />
lors <strong>de</strong> son appel et d’y inclure en <strong>de</strong>scription le chemin <strong>de</strong> là où elle est en co<strong>de</strong> source.<br />
options mautolocin<strong>de</strong>s;<br />
%put %lowcase(EN MINUSCULES);<br />
proc catalog cat=work.sasmacr;contents;run;<br />
Le source <strong>de</strong> lowcase est<br />
%macro lowcase(string);<br />
%*********************************************************************;<br />
%* MACRO: LOWCASE *;<br />
%* *;<br />
%* USAGE: 1) %lowcase(argument) *;<br />
%* DESCRIPTION: *;<br />
%* This macro returns the argument passed to it unchanged *;<br />
%* except that all upper-case alphabetic characters are changed *;<br />
%* to their lower-case equivalents. *;<br />
%* E.g.: %let macvar=%lowcase(<strong>Sas</strong> Institute Inc.); %*;<br />
%* The variable macvar gets the value "<strong>Sas</strong> institute inc." *;<br />
%* *;<br />
%* NOTES: *;<br />
%* Although the argument to the %UPCASE macro function may *;<br />
%* contain commas, the argument to %LOWCASE may not, unless *;<br />
%* they are quoted. Because %LOWCASE is a macro, not a function, *;<br />
%* it interprets a comma as the end of a parameter. *;<br />
%*********************************************************************;<br />
%sysfunc(lowcase(%nrbquote(&string)))<br />
%mend;<br />
a été compilé et stocké en work.sasmacr avec l’indication <strong>de</strong> son chemin complet en <strong>de</strong>scriptif!<br />
2.4.4.2 MAUTOCOMPLOC<br />
provoquera l’indication sur la log du lieu d’origine <strong>de</strong> la macro à sa compilation<br />
options <strong>Sas</strong>autos=("d:\astuces\ladiray" <strong>Sas</strong>autos) mautosource;<br />
options mautocomploc ;<br />
%univariate(data=<strong>Sas</strong>help.class,var=age)<br />
185 %univariate(data=<strong>Sas</strong>help.class,var=age)<br />
MAUTOCOMPLOC: La macro autocall UNIVARIATE se compile à l'ai<strong>de</strong> du fichier source autocall<br />
d:\astuces\ladiray\univariate.sas.<br />
2.4.4.3 Valeurs <strong>de</strong> SYSSCPL etc<br />
Rappel <strong>de</strong>s valeurs <strong>de</strong> SYSSCPL avec <strong>Windows</strong> 7 sont W32_VSPRO pour Microsoft <strong>Windows</strong> Vista/7 32bits et<br />
X64_VSPRO pour Microsoft <strong>Windows</strong> Vista x64 or <strong>Windows</strong> 7 x64. Le SYSENCODING est wlatin1 par défaut.<br />
La SYSVLONG4 donnera (en juin 2012) 9.03.01M0P06072011 soit la 9.3.0 ou 9.3 pour SYSVER.<br />
2.4.5 Enrichissement du select … into :… <strong>de</strong> la proc sql<br />
Une nouveauté pratique intéressante a été ajoutée à l’opérateur macro INTO : utilisée dans un proc sql.<br />
proc sql noprint;<br />
select distinct age into :varval1- from <strong>Sas</strong>help.class;<br />
%let varnb= &sqlobs.;<br />
quit;%put _user_;<br />
Comme le montre le résultat ci-après, il est possible maintenant d’affecter dans <strong>de</strong>s MV à indice croissant les<br />
valeurs distinctes d’une variable sans en connaître leur nombre !<br />
77 INED Service Informatique Wielki