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

SAS Base Discussion :

Importation fichier texte contenant des emails, dates, etc.


Sujet :

SAS Base

  1. #1
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    19
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : Vietnam

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2014
    Messages : 19
    Points : 23
    Points
    23
    Par défaut Importation fichier texte contenant des emails, dates, etc.
    Bonjour,

    test1.txt
    J'ai un fichier,il est un peu merdique(ci dessus)
    J'ai utilisé le proc import pour l'importer mais je ne peux pas vérifier si le fichier est bien importé ou pas
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    proc import datafile ="T:\Datamining\Projets\Stage 2014\Vu Viet Hai\NEWSLETTER\Input\ouvreurs_20130703.txt" 
    out=test
    DBMS=tab replace;
    getnames =yes;
    run;

  2. #2
    Membre habitué
    Homme Profil pro
    sas help desk et installateur
    Inscrit en
    Mai 2010
    Messages
    41
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : sas help desk et installateur
    Secteur : Service public

    Informations forums :
    Inscription : Mai 2010
    Messages : 41
    Points : 143
    Points
    143
    Par défaut
    VuVietHai

    J'ai essayé avec Stattransfer
    mais le résultat est le même.

    s'il y a un problème avec les données, il faut les corriger ou adapter le programme sas généré
    que vous pouvez rappeler à l'aide F4 sous sas foundation.

    Le voici rappelé
    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
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
     
     /**********************************************************************
     *   PRODUCT:   SAS
     *   VERSION:   9.3
     *   CREATOR:   External File Interface
     *   DATE:      29JUL14
     *   DESC:      Generated SAS Datastep Code
     *   TEMPLATE SOURCE:  (None Specified.)
     ***********************************************************************/
        data WORK.TEST    ;
        %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
        infile 'd:\test1.txt' delimiter='09'x MISSOVER DSD lrecl=800 firstobs=2 ;
           informat Email $27. ;
           informat Error best32. ;
           informat ErrorDate anydtdtm40. ;
           informat JoinDate anydtdtm40. ;
           informat UpdateDate anydtdtm40. ;
           informat LeaveDate anydtdtm40. ;
           informat OptOut best32. ;
           informat Label_Optout $24. ;
           informat Status best32. ;
           informat MsgFormatId best32. ;
           informat Format $4. ;
           informat SalutationId $1. ;
           informat Salutation $1. ;
           informat FirstName $22. ;
           informat LastName $10. ;
           informat BirthDate $1. ;
           informat CustomDate1 ddmmyy10. ;
           informat CustomDate2 $1. ;
           informat CustomDate3 $1. ;
           informat Company $1. ;
           informat Address1 $1. ;
           informat Address2 $1. ;
           informat Address3 $1. ;
           informat ZipCode best32. ;
           informat City $8. ;
           informat CountryId $1. ;
           informat Mobile best32. ;
           informat Phone $1. ;
           informat Fax $1. ;
           informat CustomStr1 $12. ;
           informat CustomStr2 best32. ;
           informat CustomStr3 comma32. ;
           informat CustomStr4 $15. ;
           informat CustomStr5 best32. ;
           informat CustomStr6 $7. ;
           informat CustomStr7 $5. ;
           informat CustomStr8 comma32. ;
           informat CustomStr9 comma32. ;
           informat CustomStr10 comma32. ;
           informat CustomStr11 $8. ;
           informat CustomStr12 best32. ;
           informat CustomStr13 $7. ;
           informat CustomStr14 $8. ;
           informat CustomStr15 $5. ;
           informat CustomStr16 comma32. ;
           informat CustomStr17 comma32. ;
           informat CustomStr18 $1. ;
           informat CustomStr19 comma32. ;
           informat CustomStr20 comma32. ;
           informat CustomStr21 comma32. ;
           informat CustomStr22 comma32. ;
           informat CustomStr23 comma32. ;
           informat CustomStr24 comma32. ;
           informat CustomStr25 comma32. ;
           informat CustomStr26 comma32. ;
           informat CustomStr27 $8. ;
           informat CustomStr28 $8. ;
           informat CustomStr29 $1. ;
           informat CustomStr30 $8. ;
           informat CustomInt1 best32. ;
           informat CustomInt2 $1. ;
           informat CustomInt3 $1. ;
           informat CustomInt4 $1. ;
           informat CustomInt5 $1. ;
           informat CustomInt6 $1. ;
           informat CustomInt7 $1. ;
           informat CustomInt8 $1. ;
           informat CustomInt9 $1. ;
           informat CustomInt10 $1. ;
           informat CodeSaleMgt best32. ;
           informat DescriptifSaleMgt $1. ;
           informat fin $1. ;
           informat VAR73 $1. ;
           informat VAR74 $1. ;
           informat VAR75 $1. ;
           informat VAR76 $1. ;
           informat VAR77 $1. ;
           informat VAR78 $1. ;
           informat VAR79 $1. ;
           informat VAR80 $1. ;
           informat VAR81 $1. ;
           informat VAR82 $1. ;
           informat VAR83 $1. ;
           informat VAR84 $1. ;
           informat VAR85 $1. ;
           informat VAR86 $8. ;
           informat VAR87 best32. ;
           informat VAR88 $5. ;
           format Email $27. ;
           format Error best12. ;
           format ErrorDate datetime. ;
           format JoinDate datetime. ;
           format UpdateDate datetime. ;
           format LeaveDate datetime. ;
           format OptOut best12. ;
           format Label_Optout $24. ;
           format Status best12. ;
           format MsgFormatId best12. ;
           format Format $4. ;
           format SalutationId $1. ;
           format Salutation $1. ;
           format FirstName $22. ;
           format LastName $10. ;
           format BirthDate $1. ;
           format CustomDate1 ddmmyy10. ;
           format CustomDate2 $1. ;
           format CustomDate3 $1. ;
           format Company $1. ;
           format Address1 $1. ;
           format Address2 $1. ;
           format Address3 $1. ;
           format ZipCode best12. ;
           format City $8. ;
           format CountryId $1. ;
           format Mobile best12. ;
           format Phone $1. ;
           format Fax $1. ;
           format CustomStr1 $12. ;
           format CustomStr2 best12. ;
           format CustomStr3 comma12. ;
           format CustomStr4 $15. ;
           format CustomStr5 best12. ;
           format CustomStr6 $7. ;
           format CustomStr7 $5. ;
           format CustomStr8 comma12. ;
           format CustomStr9 comma12. ;
           format CustomStr10 comma12. ;
           format CustomStr11 $8. ;
           format CustomStr12 best12. ;
           format CustomStr13 $7. ;
           format CustomStr14 $8. ;
           format CustomStr15 $5. ;
           format CustomStr16 comma12. ;
           format CustomStr17 comma12. ;
           format CustomStr18 $1. ;
           format CustomStr19 comma12. ;
           format CustomStr20 comma12. ;
           format CustomStr21 comma12. ;
           format CustomStr22 comma12. ;
           format CustomStr23 comma12. ;
           format CustomStr24 comma12. ;
           format CustomStr25 comma12. ;
           format CustomStr26 comma12. ;
           format CustomStr27 $8. ;
           format CustomStr28 $8. ;
           format CustomStr29 $1. ;
           format CustomStr30 $8. ;
           format CustomInt1 best12. ;
           format CustomInt2 $1. ;
           format CustomInt3 $1. ;
           format CustomInt4 $1. ;
           format CustomInt5 $1. ;
           format CustomInt6 $1. ;
           format CustomInt7 $1. ;
           format CustomInt8 $1. ;
           format CustomInt9 $1. ;
           format CustomInt10 $1. ;
           format CodeSaleMgt best12. ;
           format DescriptifSaleMgt $1. ;
           format fin $1. ;
           format VAR73 $1. ;
           format VAR74 $1. ;
           format VAR75 $1. ;
           format VAR76 $1. ;
           format VAR77 $1. ;
           format VAR78 $1. ;
           format VAR79 $1. ;
           format VAR80 $1. ;
           format VAR81 $1. ;
           format VAR82 $1. ;
           format VAR83 $1. ;
           format VAR84 $1. ;
           format VAR85 $1. ;
           format VAR86 $8. ;
           format VAR87 best12. ;
           format VAR88 $5. ;
        input
                    Email $
                    Error
                    ErrorDate
                    JoinDate
                    UpdateDate
                    LeaveDate
                    OptOut
                    Label_Optout $
                    Status
                    MsgFormatId
                    Format $
                    SalutationId $
                    Salutation $
                    FirstName $
                    LastName $
                    BirthDate $
                    CustomDate1
                    CustomDate2 $
                    CustomDate3 $
                    Company $
                    Address1 $
                    Address2 $
                    Address3 $
                    ZipCode
                    City $
                    CountryId $
                    Mobile
                    Phone $
                    Fax $
                    CustomStr1 $
                    CustomStr2
                    CustomStr3
                    CustomStr4 $
                    CustomStr5
                    CustomStr6 $
                    CustomStr7 $
                    CustomStr8
                    CustomStr9
                    CustomStr10
                    CustomStr11 $
                    CustomStr12
                    CustomStr13 $
                    CustomStr14 $
                    CustomStr15 $
                    CustomStr16
                    CustomStr17
                    CustomStr18 $
                    CustomStr19
                    CustomStr20
                    CustomStr21
                    CustomStr22
                    CustomStr23
                    CustomStr24
                    CustomStr25
                    CustomStr26
                    CustomStr27 $
                    CustomStr28 $
                    CustomStr29 $
                    CustomStr30 $
                    CustomInt1
                    CustomInt2 $
                    CustomInt3 $
                    CustomInt4 $
                    CustomInt5 $
                    CustomInt6 $
                    CustomInt7 $
                    CustomInt8 $
                    CustomInt9 $
                    CustomInt10 $
                    CodeSaleMgt
                    DescriptifSaleMgt $
                    fin $
                    VAR73 $
                    VAR74 $
                    VAR75 $
                    VAR76 $
                    VAR77 $
                    VAR78 $
                    VAR79 $
                    VAR80 $
                    VAR81 $
                    VAR82 $
                    VAR83 $
                    VAR84 $
                    VAR85 $
                    VAR86 $
                    VAR87
                    VAR88 $
        ;
        if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
        run;
    la variable fin est une variable rajoutée car dans votre fichier original
    il y avait doute sur le dernier champ sans nom de la première ligne

    Le programme généré peut bien sûr être optimisé

    AW

Discussions similaires

  1. [Débutant] Importer fichier texte avec des cases vides
    Par doublegadobax dans le forum MATLAB
    Réponses: 2
    Dernier message: 20/05/2011, 17h05
  2. [TP] Lecture d'un fichier texte contenant des coordonnées
    Par ichiwa dans le forum Turbo Pascal
    Réponses: 10
    Dernier message: 04/02/2007, 15h07
  3. Charger un fichier texte contenant des caractères
    Par dm_manu dans le forum MATLAB
    Réponses: 5
    Dernier message: 24/12/2006, 02h37
  4. Import fichier texte avec des champs variables
    Par joshua12 dans le forum Access
    Réponses: 4
    Dernier message: 26/09/2006, 09h06
  5. Réponses: 3
    Dernier message: 22/06/2006, 17h34

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