Hello , Good morning , I own a table "refec9" with this fields : numero_police application flux cause_evenement anomalie date_creation_rejet acteur statut analyse_gestion analyse_moe date_derniere_modif lid rolper numper I want create 8 tables in function of the fields "acteur" . This field can own 8 differents value in the table refec9. I have built this sas code to export in SAS by data _null_ with file : data _null_;
set work.refec9;
mois = month(input("&sysdate9",date9.));
annee = year(input("&sysdate9",date9.));
jour = day(input("&sysdate9",date9.));
call symput('mois',compress(put(mois,Z2.)));
call symput('annee',compress(put(annee,best.)));
call symput('jour',compress(put(jour,Z2.)));
call symputx('lien','\\batd0\bases_rad\ficovie\');
call symputx('fichier','_ACTEURXXX');
call symputx('acteur00','MOA Reglementaire');
call symputx('acteur01','MOE FICOVIE');
call symputx('acteur02','Gestion Pegase');
call symputx('acteur03','Gestion 8X');
call symputx('acteur04','Gestion PTV');
call symputx('acteur05','Gestion Espece');
call symputx('acteur06','Gestion Obseques');
call symputx('acteur07','Gestion BIGBEN');
call symputx('header','numero_police application flux cause_evenement anomalie date_creation_rejet acteur statut analyse_gestion analyse_moe date_derniere_modif lid rolper numper');
if FIRST.acteur then do;
put &header;
if refec9.acteur=&acteur00 then do;
file "&lien&annee&mois&jour&acteur00..xlsx" encoding="UTF-8" ;
put numero_police application flux cause_evenement anomalie date_creation_rejet acteur statut analyse_gestion analyse_moe date_derniere_modif lid rolper numper;
end;
else
if refec9.acteur=&acteur01 then do;
file "&lien&annee&mois&jour&acteur01..xlsx" encoding="UTF-8" ;
put numero_police application flux cause_evenement anomalie date_creation_rejet acteur statut analyse_gestion analyse_moe date_derniere_modif lid rolper numper;
end;
end;
run; In the log I can see this : 24 data _null_; 25 26 set work.refec9; 27 28 mois = month(input("&sysdate9",date9.)); SYMBOLGEN: Macro variable SYSDATE9 resolves to 23NOV2017 29 annee = year(input("&sysdate9",date9.)); SYMBOLGEN: Macro variable SYSDATE9 resolves to 23NOV2017 30 jour = day(input("&sysdate9",date9.)); SYMBOLGEN: Macro variable SYSDATE9 resolves to 23NOV2017 31 call symput('mois',compress(put(mois,Z2.))); 32 call symput('annee',compress(put(annee,best.))); 33 call symput('jour',compress(put(jour,Z2.))); 34 call symputx('lien','\\batd0\bases_rad\ficovie\'); 35 call symputx('fichier','_ACTEURXXX'); 36 call symputx('acteur00','MOA Reglementaire'); 37 call symputx('acteur01','MOE FICOVIE'); 38 call symputx('acteur02','Gestion Pegase'); 39 call symputx('acteur03','Gestion 8X'); 40 call symputx('acteur04','Gestion PTV'); 41 call symputx('acteur05','Gestion Espece'); 42 call symputx('acteur06','Gestion Obseques'); 43 call symputx('acteur07','Gestion BIGBEN'); 44 call symputx('header','numero_police application flux cause_evenement anomalie date_creation_rejet acteur statut 44 ! analyse_gestion analyse_moe date_derniere_modif lid rolper numper'); 45 46 if FIRST.acteur then do; 47 put &header; _ 22 WARNING: Apparent symbolic reference HEADER not resolved. 2 The SAS System 09:23 Thursday, November 23, 2017 48 if refec9.acteur=&acteur00 then do; _____________ 557 ERROR: DATA STEP Component Object failure. Aborted during the COMPILATION phase. ERROR 22-322: Expecting a name. ERROR 557-185: Variable refec9 is not an object. NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds SYMBOLGEN: Macro variable ACTEUR00 resolves to MOA Reglementaire SYMBOLGEN: Macro variable LIEN resolves to \\batd0\bases_rad\ficovie\ SYMBOLGEN: Macro variable ANNEE resolves to 2017 SYMBOLGEN: Macro variable MOIS resolves to 11 SYMBOLGEN: Macro variable JOUR resolves to 23 SYMBOLGEN: Macro variable ACTEUR00 resolves to MOA Reglementaire 49 file "&lien&annee&mois&jour&acteur00..xlsx" encoding="UTF-8" ; 50 put numero_police application flux cause_evenement anomalie date_creation_rejet acteur statut analyse_gestion 50 ! analyse_moe date_derniere_modif lid rolper numper; 51 end; 52 else 53 if refec9.acteur=&acteur01 then do; SYMBOLGEN: Macro variable ACTEUR01 resolves to MOE FICOVIE SYMBOLGEN: Macro variable LIEN resolves to \\batd0\bases_rad\ficovie\ SYMBOLGEN: Macro variable ANNEE resolves to 2017 SYMBOLGEN: Macro variable MOIS resolves to 11 SYMBOLGEN: Macro variable JOUR resolves to 23 SYMBOLGEN: Macro variable ACTEUR01 resolves to MOE FICOVIE 54 file "&lien&annee&mois&jour&acteur01..xlsx" encoding="UTF-8" ; 55 put numero_police application flux cause_evenement anomalie date_creation_rejet acteur statut analyse_gestion 55 ! analyse_moe date_derniere_modif lid rolper numper; 56 end; 57 end; 58 59 run; 60 61 GOPTIONS NOACCESSIBLE; 62 %LET _CLIENTTASKLABEL=; 63 %LET _CLIENTPROJECTPATH=; 64 %LET _CLIENTPROJECTNAME=; 65 %LET _SASPROGRAMFILE=; 66 67 ;*';*";*/;quit;run; 68 ODS _ALL_ CLOSE; 69 70 71 QUIT; RUN; SAS refuse to read when there is "table.field" in the condition , and refuse to read several variables like "header" or "acteurXX" to divide the table in several file. I have use this documentation : http://www.users.miamioh.edu/baileraj/classes/sta402/FALL-2007/handouts/week-09-02nov07-write-transf.pdf , https://thesasreference.wordpress.com/tag/data-_null_/ , http://www2.sas.com/proceedings/sugi27/p061-27.pdf . I don't why SAS refuse to accept variable like "header" or "acteurxx" in condition ??? If you have an idea you can give it 🙂
... View more