You are on page 1of 4

/********************** Example 2.

1 **********************/
* Creates a temporary SAS data set named DISTANCE;
DATA distance;
Miles = 26.22;
Kilometers = 1.61 * Miles;
PROC PRINT DATA = distance; /* Print the results */
RUN;

* Creates a temporary SAS data set named DISTANCE;


DATA distance; Miles = 26.22; Kilometers =
1.61 * Miles;
PROC PRINT DATA = distance; /* Print the results */ RUN;

/*********************************************************/
/********************** Example 2.4 **********************/
* Creates a temporary SAS data set named DISTANCE;
DATA distance;
Miles = 26.22;
Kilometers = 1.61 * Miles;
ODS LISTING; /* Turn listing destination-output window on */
PROC PRINT DATA = distance; /* Print the results */
RUN;
ODS _ALL_ CLOSE; /* Turn off listing destination */

/*********************************************************/
/********************** Example 2.7 **********************/
* Creates a temporary SAS data set named distance;
DATA distance;
Miles = 26.22;
Kilometers = 1.61 * Miles;
PROC PRINT DATA = distance; /* Print the results */
RUN;

* Print description & variable attributes of data set;


PROC CONTENTS DATA = distance;
RUN;

/*********************************************************/
/********************** Example 2.8 **********************/
LIBNAME test 'C:\Users\elainemo\';
DATA test.distance;
Miles = 26.22;
Kilometers = 1.61 * Miles;
RUN;
PROC PRINT DATA = test.distance;
RUN;

FILENAME distance 'C:\Users\elainemo\';


PROC PRINT DATA = test.distance;
RUN;

/*********************************************************/
/********************** Example 2.9 **********************/
* Creates a temporary SAS data set named distance;
DATA distance;
Miles = 26.22;
Kilometers = 1.61 * Miles;
PROC PRINT DATA = distance; /* Print the results */
RUN;

* Save SAS data set named distance;


DATA 'C:\Users\elainemo\distance';
SET distance;
RUN;

/*********************************************************/
/********************** Example 2.10 *********************/
* Creates a temporary SAS data set named distance;
DATA distance;
Miles = 26.22;
Kilometers = 1.61 * Miles;
PROC PRINT DATA = distance; /* Print the results */
RUN;

* Print contents of a library & description & variable attributes of data set;
PROC CONTENTS DATA=work._ALL_ NODETAILS;
RUN;

/*********************************************************/
/********************** Example 2.11 *********************/
* Creates a temporary SAS data set named distance;
DATA distance;
Miles = 26.22;
Kilometers = 1.61 * Miles;
PROC PRINT DATA = distance; /* Print the results */
RUN;

ODS LISTING; /* Turn listing destination-output window on */


OPTIONS DATE NOCENTER PAGENO=1 PAGESIZE=15;
PROC PRINT DATA= distance;
RUN;
ODS _ALL_ CLOSE;

/*********************************************************/
/********************** Example 2.12 *********************/
DATA distance;
Miles = 26.22;
Kilometers = 1.61 * Miles;
PROC PRINT DATA = distance
RUN;

/*********************************************************/
/********************** Example 2.13 *********************/
DATA distance;
Miles = 26.22;
Kilometers = 1.61 * Miles;
PROC PRINT DATA = distance KEYLABEL;
RUN;

/*********************************************************/
/********************** Example 2.14 *********************/
DAT distance;
Miles = 26.22;
Kilometers = 1.61 * Miles;
PROC PRINT DATA = distance;
RUN;

/*********************************************************/
/********************** Example 2.15 *********************/
LIBNAME test "C:\Users\elainemo\';
DATA test.distance;
Miles = 26.22;
Kilometers = 1.61 * Miles;
RUN;
PROC PRINT DATA = test.distance;
RUN;

"/*********************************************************/
/********************** Example 2.16 *********************/
DATA distance;
Miles = 26.22;
PROC PRINT DATA = distance;
Kilometers = 1.61 * Miles;
RUN;

/*********************************************************/
/********************** Example 2.17 *********************/
LIBNAME plants 'c:\Users\elainemo\';
DATA plants.magnolia;
INPUT ScientificName $ 1-14 CommonName $ 16-32 MaximumHeight AgeBloom Type $ Color
$;
DATALINES;
M. grandiflora Southern Magnolia 80 15 E white
M. campbellii 80 20 D rose
M. liliiflora Lily Magnolia 12 4 D purple
M. soulangiana Saucer Magnolia 25 3 D pink
M. stellata Star Magnolia 10 3 D white
;
RUN;

/* Print the results */


LIBNAME example 'c:\Users\elainemo\';
PROC PRINT DATA = example.magnolia;
TITLE 'Magnolias';
RUN;

/*********************************************************/
/********************** Example 2.18 *********************/
DATA 'c:\Users\elainemo\magnolia';
INFILE 'c:\Users\elainemo\Mag.dat';
INPUT ScientificName $ 1-14 CommonName $ 16-32 MaximumHeight AgeBloom Type $ Color
$;
RUN;

/* Print the results */


ODS LISTING;
PROC PRINT DATA = 'c:\Users\elainemo\magnolia';
TITLE 'Magnolias';
RUN;
ODS _ALL_ CLOSE;

You might also like