<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Issue with Call Execute in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14431#M1836</link>
    <description>Thanks &lt;BR /&gt;
data _null_;,&lt;BR /&gt;
it does not work. it produces a syntax error.&lt;BR /&gt;
&lt;BR /&gt;
May be I should have a look at the proc append instead of testing if the table exist.&lt;BR /&gt;
&lt;BR /&gt;
phil</description>
    <pubDate>Tue, 04 May 2010 07:36:22 GMT</pubDate>
    <dc:creator>phil27</dc:creator>
    <dc:date>2010-05-04T07:36:22Z</dc:date>
    <item>
      <title>Issue with Call Execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14429#M1834</link>
      <description>Hi,&lt;BR /&gt;
I use the following macro to detect if a table exists.&lt;BR /&gt;
&lt;BR /&gt;
At the first run when MyTableDest does not exist the macro creates MyTableDest.&lt;BR /&gt;
&lt;BR /&gt;
But at the second run, instead of appending the lines of MyTableSource to MyTableDest the macro behaves like if MyTableDest did not exist.&lt;BR /&gt;
&lt;BR /&gt;
From the third run it works well.&lt;BR /&gt;
&lt;BR /&gt;
If someone has an idea, it would be great.&lt;BR /&gt;
Thanks.&lt;BR /&gt;
&lt;BR /&gt;
%Macro IntegreTable(MyTableSource, MyTableDest);&lt;BR /&gt;
	/* Vérification si MyTableDest existe */&lt;BR /&gt;
	%LOCAL bTableExiste;&lt;BR /&gt;
	%let bTableExiste=%sysfunc(exist(&amp;amp;MyTableDest));&lt;BR /&gt;
 &lt;BR /&gt;
	/* Si table existe déjà alors ajout de MyTableSource */&lt;BR /&gt;
	 %IF %eval(&amp;amp;bTableExiste) eq 1 %then %do;&lt;BR /&gt;
	 	DATA &amp;amp;MyTableDest;&lt;BR /&gt;
		SET &amp;amp;MyTableDest &amp;amp;MyTableSource;&lt;BR /&gt;
		run;&lt;BR /&gt;
	  %end;&lt;BR /&gt;
 &lt;BR /&gt;
	  /* Si la table n'existe pas alors création */&lt;BR /&gt;
      %else %do;&lt;BR /&gt;
	  	DATA &amp;amp;MyTableDest;&lt;BR /&gt;
		SET &amp;amp;MyTableSource;&lt;BR /&gt;
		run;&lt;BR /&gt;
	  %end;&lt;BR /&gt;
%Mend;&lt;BR /&gt;
&lt;BR /&gt;
%Macro CreeTableMensuelle(MyTableRef, MyRepIn, MyLibOut, MyTableOut, MyAnnee, MyMois, MyPeriode);&lt;BR /&gt;
	/* Récupération des informations utiles au traitement des fichiers */&lt;BR /&gt;
	Proc Sql NoPrint;&lt;BR /&gt;
		Create Table temp As&lt;BR /&gt;
		Select Distinct Fichier,Mois,Annee,Periode,FicOk&lt;BR /&gt;
		From &amp;amp;MyTableRef;&lt;BR /&gt;
	Quit;&lt;BR /&gt;
&lt;BR /&gt;
	/* On parcourt la liste des fichiers */&lt;BR /&gt;
	DATA _NULL_;&lt;BR /&gt;
		SET temp;&lt;BR /&gt;
&lt;BR /&gt;
		PrefD="D_";&lt;BR /&gt;
		PrefC="C_";&lt;BR /&gt;
		Post="A_TRAITER\";&lt;BR /&gt;
&lt;BR /&gt;
		MyRepIn=&amp;amp;MyRepIn;&lt;BR /&gt;
		MyAnnee=&amp;amp;MyAnnee;&lt;BR /&gt;
		MyMois=&amp;amp;MyMois;&lt;BR /&gt;
		MyPeriode=&amp;amp;MyPeriode;&lt;BR /&gt;
		MyLibOut=&amp;amp;MyLibOut;&lt;BR /&gt;
		MyTableOut=&amp;amp;MyTableOut;&lt;BR /&gt;
		&lt;BR /&gt;
		/* Cats et CatX enlèvent les blancs aux extrêmités */&lt;BR /&gt;
		/* CatX permet d'insérer un séparateur (1er argument) entre chaque (autre) argument dans la chaîne résultat */&lt;BR /&gt;
		IF Annee eq MyAnnee AND Mois eq MyMois AND Periode eq MyPeriode AND FicOk eq 1 then do;&lt;BR /&gt;
&lt;BR /&gt;
			IF MyPeriode='A' then stRep=catx('\',MyRepIn,MyAnnee,MyMois,'ANNUEL',Post);&lt;BR /&gt;
			If MyPeriode='M' then stRep=catx('\',MyRepIn,MyAnnee,MyMois,'MENSUEL',Post);&lt;BR /&gt;
			 &lt;BR /&gt;
			rc=libname('LibSrc',stRep);&lt;BR /&gt;
&lt;BR /&gt;
			/* Agrégation fichier de données */&lt;BR /&gt;
			stFichierIn=cats(PrefD,Fichier);&lt;BR /&gt;
			stTableOut=cats(MyLibOut,'.',PrefD,MyTableOut);&lt;BR /&gt;
			CALL EXECUTE ('%IntegreTable(LibSrc.'||StFichierIn||','||stTableOut||')');&lt;BR /&gt;
&lt;BR /&gt;
			/* Agrégation fichier de tests */&lt;BR /&gt;
			stFichierIn=cats(PrefC,Fichier);&lt;BR /&gt;
			stTableOut=cats(MyLibOut,'.',PrefC,MyTableOut);&lt;BR /&gt;
			CALL EXECUTE ('%IntegreTable(LibSrc.'||StFichierIn||','||stTableOut||')');&lt;BR /&gt;
		end;&lt;BR /&gt;
	run;&lt;BR /&gt;
&lt;BR /&gt;
	/* Suppression des tables temporaires */&lt;BR /&gt;
	Proc Delete Data=temp; Run;&lt;BR /&gt;
&lt;BR /&gt;
%mend;</description>
      <pubDate>Mon, 03 May 2010 15:19:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14429#M1834</guid>
      <dc:creator>phil27</dc:creator>
      <dc:date>2010-05-03T15:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Call Execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14430#M1835</link>
      <description>See if %NRSTR will fix it.&lt;BR /&gt;
&lt;BR /&gt;
Change &lt;BR /&gt;
&lt;BR /&gt;
[pre]CALL EXECUTE ('%IntegreTable(LibSrc.'||StFichierIn||','||stTableOut||')');[/pre]&lt;BR /&gt;
&lt;BR /&gt;
to&lt;BR /&gt;
&lt;BR /&gt;
[pre]CALL EXECUTE ('%NRSTR(%IntegreTable LibSrc.'||StFichierIn||','||stTableOut||'))');[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Usually you want to delay execution of the CALL EXECUTED macro until after the data step finishes.  Check docs for details.&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: data _null_;

Message was edited by: data _null_;</description>
      <pubDate>Mon, 03 May 2010 16:36:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14430#M1835</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-05-03T16:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Call Execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14431#M1836</link>
      <description>Thanks &lt;BR /&gt;
data _null_;,&lt;BR /&gt;
it does not work. it produces a syntax error.&lt;BR /&gt;
&lt;BR /&gt;
May be I should have a look at the proc append instead of testing if the table exist.&lt;BR /&gt;
&lt;BR /&gt;
phil</description>
      <pubDate>Tue, 04 May 2010 07:36:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14431#M1836</guid>
      <dc:creator>phil27</dc:creator>
      <dc:date>2010-05-04T07:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Call Execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14432#M1837</link>
      <description>&amp;gt; it does not work. it produces a syntax error.&lt;BR /&gt;
&lt;BR /&gt;
That's not very helpful.  I would need to see the error.  &lt;BR /&gt;
&lt;BR /&gt;
I expect the missplaced character.</description>
      <pubDate>Tue, 04 May 2010 12:02:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14432#M1837</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-05-04T12:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Call Execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14433#M1838</link>
      <description>The exact error is :&lt;BR /&gt;
&lt;BR /&gt;
NOTE: L'étape DATA a utilisé (Durée totale du traitement) :&lt;BR /&gt;
      temps réel          0.00 secondes&lt;BR /&gt;
      temps UC            0.00 secondes&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
      -----------------------------------&lt;BR /&gt;
      180&lt;BR /&gt;
ERROR 180-322: Instruction incorrecte ou mal utilisée.&lt;BR /&gt;
&lt;BR /&gt;
2    +&lt;BR /&gt;
                                                      )&lt;BR /&gt;
3    + data AppliCft.C_Agreg200912A;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: Ligne générée par la routine CALL EXECUTE.&lt;BR /&gt;
3    +                                       set AppliCft.C_Agreg200912A LibSrc.C_A0200161CERTIV59UCANS1X359;&lt;BR /&gt;
                                             ---&lt;BR /&gt;
                                             180&lt;BR /&gt;
&lt;BR /&gt;
ERROR 180-322: Instruction incorrecte ou mal utilisée.</description>
      <pubDate>Tue, 04 May 2010 12:29:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14433#M1838</guid>
      <dc:creator>phil27</dc:creator>
      <dc:date>2010-05-04T12:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Call Execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14434#M1839</link>
      <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
I believe the reason is that the SAS code generated by your macro executes at another time in the process than you assume (..until the step boundary has been passed).&lt;BR /&gt;
&lt;BR /&gt;
"If an EXECUTE routine argument is a macro invocation or resolves to one, the macro executes immediately. However, any SAS statements produced by the EXECUTE routine do not execute until after the step boundary has been passed."&lt;BR /&gt;
&lt;BR /&gt;
(http://support.sas.com/onlinedoc/913/getDoc/en/mcrolref.hlp/a000543697.htm)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Tue, 04 May 2010 12:49:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14434#M1839</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-05-04T12:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Call Execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14435#M1840</link>
      <description>Ok,&lt;BR /&gt;
thanks Patrick.&lt;BR /&gt;
&lt;BR /&gt;
So I should try not to use Call Execute.&lt;BR /&gt;
&lt;BR /&gt;
Phil</description>
      <pubDate>Tue, 04 May 2010 13:12:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14435#M1840</guid>
      <dc:creator>phil27</dc:creator>
      <dc:date>2010-05-04T13:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Call Execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14436#M1841</link>
      <description>I believe there is an extra right parenthesis that is causing the error.  Show your code again and the error.  Show more of the log.  &lt;BR /&gt;
&lt;BR /&gt;
And use {pre} and {/pre} around the section of the log you post. But, use square brackets instead of the curley backets in the PRE and /PRE above.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
Example: This is surrounded by [ pre ] and [ /pre ] but without the spaces.&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 04 May 2010 14:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14436#M1841</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-05-04T14:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Call Execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14437#M1842</link>
      <description>Ok,&lt;BR /&gt;
I have removed one parenthesis in the code :&lt;BR /&gt;
&lt;BR /&gt;
here is the whole log :&lt;BR /&gt;
[PRE]&lt;BR /&gt;
34198   %Mend;&lt;BR /&gt;
34199&lt;BR /&gt;
34200   /* Test de constitution de la table mensuelle annuelle de Décembre 2009&lt;BR /&gt;
34200 !  */&lt;BR /&gt;
34201   dm log 'clear';&lt;BR /&gt;
34202   dm output 'clear';&lt;BR /&gt;
34203&lt;BR /&gt;
34204   option nomlogic symbolgen nomprint notes;&lt;BR /&gt;
34205   %Global MyRepIn;&lt;BR /&gt;
34206   %Let MyRepIn="C:\FichiersAImporter\";&lt;BR /&gt;
34207   %CreeTableMensuelle(AppliCft.Ficrecusdet,&amp;amp;MyRepIn,'AppliCft','Agreg2009&lt;BR /&gt;
34207 ! 12A',2009,12,'A');&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYREPIN traitée dans "C:\FichiersAImporter\"&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLEREF traitée dans AppliCft.Ficrecusdet&lt;BR /&gt;
NOTE: La table WORK.TEMP a été créée, avec 4 lignes et 5 col.&lt;BR /&gt;
&lt;BR /&gt;
NOTE: Procédure SQL a utilisé (Durée totale du traitement) :&lt;BR /&gt;
      temps réel          0.04 secondes&lt;BR /&gt;
      temps UC            0.00 secondes&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYREPIN traitée dans "C:\FichiersAImporter\"&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYANNEE traitée dans 2009&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYMOIS traitée dans 12&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYPERIODE traitée dans 'A'&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYLIBOUT traitée dans 'AppliCft'&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLEOUT traitée dans 'Agreg200912A'&lt;BR /&gt;
&lt;BR /&gt;
NOTE: Valeurs caractères converties en valeurs numériques&lt;BR /&gt;
      aux emplacements indiqués par : (Ligne):(Colonne).&lt;BR /&gt;
      2:212   2:233&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLEDEST traitée dans AppliCft.C_Agreg200912A&lt;BR /&gt;
SYMBOLGEN :  Macro variable BTABLEEXISTE traitée dans 1&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLEDEST traitée dans AppliCft.C_Agreg200912A&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLEDEST traitée dans AppliCft.C_Agreg200912A&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLESOURCE traitée dans&lt;BR /&gt;
             LibSrc.C_A0200161CERTIV59UCANS1X359&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLEDEST traitée dans AppliCft.C_Agreg200912A&lt;BR /&gt;
SYMBOLGEN :  Macro variable BTABLEEXISTE traitée dans 1&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLEDEST traitée dans AppliCft.C_Agreg200912A&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLEDEST traitée dans AppliCft.C_Agreg200912A&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLESOURCE traitée dans&lt;BR /&gt;
             LibSrc.C_K1422244CERTI06UCANS1V01F&lt;BR /&gt;
NOTE:  4 observation(s) lue(s) dans la table WORK.TEMP.&lt;BR /&gt;
NOTE: L'étape DATA a utilisé (Durée totale du traitement) :&lt;BR /&gt;
      temps réel          0.04 secondes&lt;BR /&gt;
      temps UC            0.00 secondes&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
NOTE: CALL EXECUTE a généré une ligne.&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLEDEST traitée dans&lt;BR /&gt;
SYMBOLGEN :  Macro variable BTABLEEXISTE traitée dans 1&lt;BR /&gt;
1      +  %IntegreTable LibSrc.D_A0200161CERTIV59UCANS1X359&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
,AppliCft.D_Agreg200912A&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLEDEST traitée dans&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLEDEST traitée dans&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLESOURCE traitée dans&lt;BR /&gt;
&lt;BR /&gt;
NOTE:  4 observation(s) lue(s) dans la table WORK.TEMP.&lt;BR /&gt;
NOTE: La table WORK.DATA4 a 4 observation(s) et 5 variable(s).&lt;BR /&gt;
NOTE: L'étape DATA a utilisé (Durée totale du traitement) :&lt;BR /&gt;
      temps réel          0.00 secondes&lt;BR /&gt;
      temps UC            0.00 secondes&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
        -----------------------------------&lt;BR /&gt;
        180&lt;BR /&gt;
ERROR 180-322: Instruction incorrecte ou mal utilisée.&lt;BR /&gt;
&lt;BR /&gt;
2      +&lt;BR /&gt;
3      + data AppliCft.C_Agreg200912A;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: Ligne générée par la routine CALL EXECUTE.&lt;BR /&gt;
3      +                                       set AppliCft.C_Agreg200912A&lt;BR /&gt;
                                               ---&lt;BR /&gt;
                                               180&lt;BR /&gt;
3     !+LibSrc.C_A0200161CERTIV59UCANS1X359;         run;&lt;BR /&gt;
&lt;BR /&gt;
ERROR 180-322: Instruction incorrecte ou mal utilisée.&lt;BR /&gt;
&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLEDEST traitée dans&lt;BR /&gt;
SYMBOLGEN :  Macro variable BTABLEEXISTE traitée dans 1&lt;BR /&gt;
4      +  %IntegreTable LibSrc.D_K1422244CERTI06UCANS1V01F&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
,AppliCft.D_Agreg200912A&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLEDEST traitée dans&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLEDEST traitée dans&lt;BR /&gt;
SYMBOLGEN :  Macro variable MYTABLESOURCE traitée dans&lt;BR /&gt;
&lt;BR /&gt;
NOTE:  4 observation(s) lue(s) dans la table WORK.DATA4.&lt;BR /&gt;
NOTE: La table WORK.DATA5 a 4 observation(s) et 5 variable(s).&lt;BR /&gt;
NOTE: L'étape DATA a utilisé (Durée totale du traitement) :&lt;BR /&gt;
      temps réel          0.00 secondes&lt;BR /&gt;
      temps UC            0.00 secondes&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
        ----------------------------------&lt;BR /&gt;
        180&lt;BR /&gt;
ERROR 180-322: Instruction incorrecte ou mal utilisée.&lt;BR /&gt;
&lt;BR /&gt;
5      +&lt;BR /&gt;
6      + data AppliCft.C_Agreg200912A;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: Ligne générée par la routine CALL EXECUTE.&lt;BR /&gt;
6      +                                       set AppliCft.C_Agreg200912A&lt;BR /&gt;
LibSrc.C_K1422244CERTI06UCANS1V01F&lt;BR /&gt;
                                               ---&lt;BR /&gt;
                                               180&lt;BR /&gt;
6     !+;         run;&lt;BR /&gt;
&lt;BR /&gt;
ERROR 180-322: Instruction incorrecte ou mal utilisée.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
NOTE: Suppression de WORK.TEMP (memtype=DATA).&lt;BR /&gt;
NOTE: Procédure DELETE a utilisé (Durée totale du traitement) :&lt;BR /&gt;
      temps réel          0.00 secondes&lt;BR /&gt;
      temps UC            0.00 secondes&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
34208&lt;BR /&gt;
34209   /* Vérif des résultats */&lt;BR /&gt;
34210   proc sql;&lt;BR /&gt;
34211       select fichier, input(nbenreg,best.) as total from&lt;BR /&gt;
34211 ! applicft.ficrecusdet where annee eq '2009' and mois eq '12' and periode&lt;BR /&gt;
34211 !  eq 'A' and FicOk eq 1;&lt;BR /&gt;
34212   quit;&lt;BR /&gt;
NOTE: Procédure SQL a utilisé (Durée totale du traitement) :&lt;BR /&gt;
      temps réel          0.01 secondes&lt;BR /&gt;
      temps UC            0.00 secondes&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
34213&lt;BR /&gt;
34214&lt;BR /&gt;
34215   proc sql;&lt;BR /&gt;
34216       select count(1) as total from applicft.d_Agreg200912A;&lt;BR /&gt;
34217   quit;&lt;BR /&gt;
NOTE: Procédure SQL a utilisé (Durée totale du traitement) :&lt;BR /&gt;
      temps réel          0.01 secondes&lt;BR /&gt;
      temps UC            0.00 secondes&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[/PRE]&lt;BR /&gt;
&lt;BR /&gt;
And the whole code :&lt;BR /&gt;
&lt;BR /&gt;
[PRE]&lt;BR /&gt;
&lt;BR /&gt;
%Global PrefD;&lt;BR /&gt;
%Global PrefC;&lt;BR /&gt;
%Global PostRep;&lt;BR /&gt;
&lt;BR /&gt;
%Global Annee;&lt;BR /&gt;
%Global Mois;&lt;BR /&gt;
%Global Periode;&lt;BR /&gt;
%Global FicOk;&lt;BR /&gt;
%Global Nom;&lt;BR /&gt;
&lt;BR /&gt;
%Global Nb;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%Macro CreeTableMensuelle(MyTableRef, MyRepIn, MyLibOut, MyTableOut, MyAnnee, MyMois, MyPeriode);&lt;BR /&gt;
	/* Récupération des informations utiles au traitement des fichiers */&lt;BR /&gt;
	Proc Sql NoPrint;&lt;BR /&gt;
		Create Table temp As&lt;BR /&gt;
		Select Distinct Fichier,Mois,Annee,Periode,FicOk&lt;BR /&gt;
		From &amp;amp;MyTableRef;&lt;BR /&gt;
	Quit;&lt;BR /&gt;
&lt;BR /&gt;
	/* On parcourt la liste des fichiers */&lt;BR /&gt;
	DATA _NULL_;&lt;BR /&gt;
		SET temp;&lt;BR /&gt;
&lt;BR /&gt;
		PrefD="D_";&lt;BR /&gt;
		PrefC="C_";&lt;BR /&gt;
		Post="A_TRAITER\";&lt;BR /&gt;
&lt;BR /&gt;
		MyRepIn=&amp;amp;MyRepIn;&lt;BR /&gt;
		MyAnnee=&amp;amp;MyAnnee;&lt;BR /&gt;
		MyMois=&amp;amp;MyMois;&lt;BR /&gt;
		MyPeriode=&amp;amp;MyPeriode;&lt;BR /&gt;
		MyLibOut=&amp;amp;MyLibOut;&lt;BR /&gt;
		MyTableOut=&amp;amp;MyTableOut;&lt;BR /&gt;
		&lt;BR /&gt;
		/* Cats et CatX enlèvent les blancs aux extrêmités */&lt;BR /&gt;
		/* CatX permet d'insérer un séparateur (1er argument) entre chaque (autre) argument dans la chaîne résultat */&lt;BR /&gt;
		IF Annee eq MyAnnee AND Mois eq MyMois AND Periode eq MyPeriode AND FicOk eq 1 then do;&lt;BR /&gt;
&lt;BR /&gt;
			IF MyPeriode='A' then stRep=catx('\',MyRepIn,MyAnnee,MyMois,'ANNUEL',Post);&lt;BR /&gt;
			If MyPeriode='M' then stRep=catx('\',MyRepIn,MyAnnee,MyMois,'MENSUEL',Post);&lt;BR /&gt;
			 &lt;BR /&gt;
			rc=libname('LibSrc',stRep);&lt;BR /&gt;
&lt;BR /&gt;
			/* Agrégation fichier de données */&lt;BR /&gt;
			stFichierIn=cats(PrefD,Fichier);&lt;BR /&gt;
			stTableOut=cats(MyLibOut,'.',PrefD,MyTableOut);&lt;BR /&gt;
			CALL EXECUTE ('%NRSTR(%IntegreTable LibSrc.'||StFichierIn||','||stTableOut||')');&lt;BR /&gt;
&lt;BR /&gt;
			/* Agrégation fichier de tests */&lt;BR /&gt;
			stFichierIn=cats(PrefC,Fichier);&lt;BR /&gt;
			stTableOut=cats(MyLibOut,'.',PrefC,MyTableOut);&lt;BR /&gt;
			CALL EXECUTE ('%NRSTR(%IntegreTable LibSrc.'||StFichierIn||','||stTableOut||')');&lt;BR /&gt;
		end;&lt;BR /&gt;
	run;&lt;BR /&gt;
&lt;BR /&gt;
	/* Suppression des tables temporaires */&lt;BR /&gt;
	Proc Delete Data=temp; Run;&lt;BR /&gt;
&lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%Macro IntegreTable(MyTableSource, MyTableDest);&lt;BR /&gt;
	/* Vérification si MyTableDest existe */&lt;BR /&gt;
	%local bTableExiste;&lt;BR /&gt;
	%let bTableExiste=%sysfunc(exist(&amp;amp;MyTableDest));&lt;BR /&gt;
&lt;BR /&gt;
	/* Si table existe déjà alors ajout de MyTableSource */&lt;BR /&gt;
	 %if %eval(&amp;amp;bTableExiste) eq 1 %then %do;&lt;BR /&gt;
	 	data &amp;amp;MyTableDest;&lt;BR /&gt;
		set &amp;amp;MyTableDest &amp;amp;MyTableSource;&lt;BR /&gt;
		run;&lt;BR /&gt;
	  %end;&lt;BR /&gt;
&lt;BR /&gt;
	  /* Si la table n'existe pas alors création */&lt;BR /&gt;
      %else %do;&lt;BR /&gt;
	  	data &amp;amp;MyTableDest;&lt;BR /&gt;
		set &amp;amp;MyTableSource;&lt;BR /&gt;
		run;&lt;BR /&gt;
	  %end;&lt;BR /&gt;
%Mend;&lt;BR /&gt;
&lt;BR /&gt;
/* Test de constitution de la table mensuelle annuelle de Décembre 2009 */&lt;BR /&gt;
dm log 'clear';&lt;BR /&gt;
dm output 'clear';&lt;BR /&gt;
&lt;BR /&gt;
option nomlogic symbolgen nomprint notes;&lt;BR /&gt;
%Global MyRepIn;&lt;BR /&gt;
%Let MyRepIn="C:\FichiersAImporter\";&lt;BR /&gt;
%CreeTableMensuelle(A.Fichier,&amp;amp;MyRepIn,'A','Agreg200912A',2009,12,'A');&lt;BR /&gt;
[/PRE]&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: phil27</description>
      <pubDate>Tue, 04 May 2010 15:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-Call-Execute/m-p/14437#M1842</guid>
      <dc:creator>phil27</dc:creator>
      <dc:date>2010-05-04T15:03:34Z</dc:date>
    </item>
  </channel>
</rss>

