Only print 10 rows, but no observation line numbers
PROC PRINT DATA=auto(obs=10) noobs;
RUN;
We can get descriptive statistics separately for foreign and domestic cars (i.e., broken down by foreign) as shown below.
PROC MEANS DATA=auto;
CLASS foreign;
RUN;
We can get detailed descriptive statistics for price using proc univariate as shown below.
PROC UNIVARIATE DATA=auto;
VAR PRICE;
RUN;
When you use the noduplicates option, the SAS Log displays a note telling you how many duplicates were removed. As you see below, SAS informs us that 1 duplicate observation was deleted.
PROC SORT DATA=auto OUT=auto5 NODUPLICATES ;
BY DESCENDING foreign ;
RUN ;
It is common for duplicate observations to be next to each other in the same file, but if the duplicate observations are not next to each other, there is another strategy you can use to remove the duplicates. You can sort the data file by all of the variables (which can be indicated with the special keyword _ALL_), which would force the duplicate observations to be next to each other. This is illustrated below.
PROC SORT DATA=auto OUT=auto6 NODUPLICATES ;
BY _all_ ;
RUN ;
No comments:
Post a Comment