top of page
PROC APPEND

Examples:

  • Adding rows, usually withe same variable names, to a dataset

PROC APPEND DATA=dataset2 BASE=dataset1 FORCE;

RUN;

PROC CONTENTS

Examples:

 

  • Importing the variables infromation of a dataset to another dataset

 

PROC CONTENTS DATA=work.dataset1 OUT=work.dataset2 NOPRINT;

RUN;

PROC DATASETS

Examples:

  • Deleting all tables from an library​

PROC DATASETS LIB=work KILL;

RUN;

 

  • Deleting a specific dataset

PROC DATASETS LIB=work;

DELETE dataset;

RUN;


 

  • Listing all datasets from a library

PROC DATASETS LIB=work MINNET=data;

RUN;

PROC SORT

 

  • Sorting a datset by a specific variable(s)

PROC SORT DATA=dataset1;

BY x1;

RUN;

PROC SQL

Examples

  • Creating a table with some statistics

PROC SQL;

    CREATE TABLE dataset1 AS

        SELECT x1, x2, x3, x4, ... , xn, COUNT(x1) AS nx1, SUM(x2) AS nx2, MEAN(x3) AS nx3, MAX(x4) AS nx4, MIN(x5) AS nx5

        FROM dataset2

            WHERE x1 = 'value'

            GROUP BY x1, x2, x3, x4, ..., xn;

            ORDER BY x1, x2

    ;

QUIT;

PROC TABULATE

Examples:

 

  • Printing a table ...

PROC TABULATE DATA=dataset FORMAT=commax6.1 MISSING;

    TABLE PERCENT,x1;

    VAR percent;

    CLASS x1;

KEYLABEL SUM=' ';

LABEL percent='%';

RUN;

 

  • Printing a table ...

PROC TABULATE DATA=dataset1 FORMAT=commax6.1 MISSING ORDER=data;

    TABLE VAR, x1 / INDENT=0;

    VAR x1;

    CLASS VAR;

KEYLABEL SUM=' ';

RUN;

 

  • Printing a table ...

PROC TABULATE DATA=dataset FORMAT=commax6.1 MISSING;

TABLE x2,(x1) / INDENT=0;

VAR x1;

CLASS x2;

KEYLABEL SUM=x2;

RUN;

 

  • Printing a table ...

PROC TABULATE DATA=dataset1 FORMAT=commax6.1 MISSING ORDER=data;

BY x1;

TABLE (x1*VAR)*x2;

VAR x2;

CLASS x1 VAR;

KEYLABEL SUM=' ';

TITLE ' ';

RUN;

 

  • Printing a table ...

PROC TABULATE DATA=dataset FORMAT=commax6.1 MISSING;

TABLE x1,(x2)*percent;

VAR percent;

CLASS x1 x2;

KEYLABEL SUM=' ';

LABAL percent='%';

RUN;

SET

Examples:

  • Replicating a table

DATA dataset2;

SET dataset 1;

RUN;

  • Concatenating two tables

DATA dataset3;

SET dataset1 dataset2;

BY x;

RUN;

PROC APPEND
PROC CONTENTS
PROC DATASETS
PROC SORT
PROC SQL
PROC TABULATE
SET

© 2021 Jorge Pinheiro

bottom of page