SlideServe
Menu
Préférences
© SlideServe · v2026

Merging SAS Data Sets

ena avatar
17 diapositives · 567 Views · May 27, 2012

Combining Data on a Common Variable. Merging: combining records from two data sets based on a common variable.General form of the data step:data SAS-data-set;merge SAS-data-sets;by variable(s);SAS-statementsrun;Data sets must be sorted.. Example. Merge monthly data on actual revenue (per

Merging SAS Data Sets - slide 1
01 / 17Merging SAS Data Sets
1 / 17

Télécharger la présentation

Merging SAS Data Sets
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation

    1. Merging SAS Data Sets STT 305

    2. Combining Data on a Common Variable Merging: combining records from two data sets based on a common variable. General form of the data step: data SAS-data-set; merge SAS-data-sets; by variable(s); SAS-statements run; Data sets must be sorted.

    3. Example Merge monthly data on actual revenue (performance) to data on goals (goals). The code: data compare; merge stt305.performance stt305.goals; by month; run;

    4. Compilation data compare; merge stt305.performance stt305.goals; by month; run; performance goals

    5. Execution data compare; merge stt305.performance stt305.goals; by month; run; performance goals

    6. Execution data compare; merge stt305.performance stt305.goals; by month; run; performance goals

    7. Non-Matches Merge the following data sets by employee ID number: Crewlist Sched

    8. Execution data schedule; merge stt305.crewlist stt305.sched; by empID; run;

    9. Execution data schedule; merge stt305.crewlist stt305.sched; by empID; run;

    10. Execution data schedule; merge stt305.crewlist stt305.sched; by empID; run;

    11. Skipping Non-Matches Suppose I only wanted to report crew members who were scheduled in previous example. One possibility—IN= option SAS-data-set(IN=variable) Variable is logical (technically, numeric) 0 indicates no contribution from that data set 1 indicates a contribution from that data set

    12. Modified Code data schedule; merge crew schedule(in=InSched); by empID; if InSched=1; run; Only outputs observations for which the by variable was present in the schedule data.

    13. One-to-Many Merges We wish to merge data sets containing information on accounts and transactions on those accounts. accounts transactions

    14. data records; merge accounts transactions; by account_no; run;

    15. data records; merge accounts transactions; by account_no; run;

    16. data records; merge accounts transactions; by account_no; run;

    17. One-to-Many Merges By this logic, how will the rest of the merge proceed? Does the order of the listing of the data sets in the merge statement make a difference?

    18. Many-to-Many Merge What would happen if I tried to merge these two data sets? salesstaff clients