IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Macro Discussion :

Concatenation de plusieurs tables avec une macro


Sujet :

Macro

  1. #1
    Nouveau Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2019
    Messages
    1
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2019
    Messages : 1
    Points : 1
    Points
    1
    Par défaut Concatenation de plusieurs tables avec une macro
    bonjour
    je disposez d’un historique de demande de dossiers entre octobre 2017
    et septembre 2018.
    j'ai réussir a faire la concaténation avec l’étape data

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    proc sort data=toto.table_201801; by ID_DOSSIER; run;
    proc sort data=toto.table_201802 ; by ID_DOSSIER; run;
    proc sort data=toto.table_201803; by ID_DOSSIER; run;
    data toto.table_finale;
    merge toto.table_201801 toto.table_201801 toto.table_201803;
    BY ID_DOSSIER;
    run;
    maintenant j,aimerais concaténer l’ensemble de
    ces tables en une nouvelle table appelée « TABLE_FINALE » à l’aide d’une macro avec comme clef de jointure ID_dossier. merci de bien vouloir m'aider

  2. #2
    Membre éprouvé
    Avatar de m.brahim
    Homme Profil pro
    SAS / BIG DATA
    Inscrit en
    Juillet 2011
    Messages
    461
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : SAS / BIG DATA
    Secteur : Conseil

    Informations forums :
    Inscription : Juillet 2011
    Messages : 461
    Points : 1 119
    Points
    1 119
    Billets dans le blog
    14
    Par défaut
    Bonjour,

    Je te propose cette solution:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
     
    data test_201701;
    input id;
    cards;
    2
    1
    3
    ;
    run;
     
    data test_201702;
    input id;
    cards;
    1
    6
    5
    ;
    run;
     
    data test_201703;
    input id;
    cards;
    1
    4
    5
    ;
    run;
     
     
    data test_201801;
    input id;
    cards;
    1
    4
    5
    ;
    run;
    option symbolgen mprint mlogic;
     
    %macro tt(date_deb=,date_fin=);
     
    %do i=0 %to %sysfunc(intck(month, %sysfunc(inputn(&date_deb,yymmn6.)), %sysfunc(inputn(&date_fin,yymmn6..)) ));
     
    %if %sysfunc(exist(test_%sysfunc(putn(%sysfunc(intnx(month,%sysfunc(inputn(&date_deb,yymmn6.)),&i)),yymmn6.)))) %then %do;
     
    proc sort data =test_%sysfunc(putn(%sysfunc(intnx(month,%sysfunc(inputn(&date_deb,yymmn6.)),&i)),yymmn6.));
     
    by id;
     
    run;
     
    %end;
     
    %end;
     
    data fin;
     
    merge %do i=0 %to %sysfunc(intck(month, %sysfunc(inputn(&date_deb,yymmn6.)), %sysfunc(inputn(&date_fin,yymmn6..)) ));
     
    %if %sysfunc(exist(test_%sysfunc(putn(%sysfunc(intnx(month,%sysfunc(inputn(&date_deb,yymmn6.)),&i)),yymmn6.)))) %then %do;
     
    test_%sysfunc(putn(%sysfunc(intnx(month,%sysfunc(inputn(&date_deb,yymmn6.)),&i)),yymmn6.))
     
    %end;
     
    %end
    ;;
     
    by id ;
     
    run;
     
    %mend tt;
     
    %tt(date_deb=201701,date_fin=201801);
    Cordialement
    Certification des Talents de la programmation In Memory Statistics sur HADOOP:
    http://talents-imstat.groupe-avisia....avance?uid=162

Discussions similaires

  1. Réponses: 2
    Dernier message: 02/03/2015, 09h38
  2. fusionner plusieurs cellules avec une macro
    Par ANGLIQUESOIG dans le forum Macros et VBA Excel
    Réponses: 3
    Dernier message: 03/06/2013, 16h01
  3. Création d'une table avec une macro SAS
    Par sasalmahboul dans le forum Macro
    Réponses: 0
    Dernier message: 03/12/2012, 00h32
  4. Réponses: 3
    Dernier message: 17/11/2006, 14h35
  5. Vider une table avec une macro
    Par Badboy62cfp dans le forum Access
    Réponses: 2
    Dernier message: 24/05/2006, 13h23

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo