0% found this document useful (0 votes)
10 views3 pages

PROC COMPARE

Uploaded by

Ramya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

PROC COMPARE

Uploaded by

Ramya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

PROC COMPARE

This procedure is used to give the full description to observation wise. By


default it gives the details of unrelated values.
Syntax:-
PROC COMPARE BASE=DATASET COMPARE=DATASET;
BY VARIABLE<S>;
VAR VARIABLES<S>;
WITH VARIABLES<S>;
RUN;
Examples:-
Data one (label='First Data Set');
Input student year state $ grade1 grade2;
Label year='Year of Birth';
Format grade1 4.1;
Cards;
1000 1970 NC 85 87
1042 1971 MD 92 92
1095 1969 PA 78 72
1187 1970 MA 87 94
;
Run;
Data two (label='Second Data Set');
Input student $ year state $ grade1 grade2 major $;
Label state='Home State';
Format grade1 5.2;
Cards;
1000 1970 NC 84 87 Math
1042 1971 MA 92 92 History
1095 1969 PA 79 73 Physics
1187 1970 MD 87 74 Dance
1204 1971 NC 82 96 French
;
Run;
Proc compare base=one compare=two;
Title 'Comparing Two Data Sets: Default Report';
Run;

Options:-
PRINT ALL – Gives differences, percentage differences and Statistics such as min, max,
mean, STD, n etc.
Proc compare base=one compare=two printall;
Title 'Comparing Two Data Sets: Full Report';
Run;

E-Mail: [email protected] Phone: +91-9848733309/+91-9676828080


www.covalentech.com & www.covalenttrainings.com
BRIEFSUMMARY – Gives summary briefly in report
Proc compare base=one compare=two briefsummary;
Title 'Comparing Two Data Sets: Brief Report';
Run;

By Statement – Prints output on each by value.


Proc sort data=one;
By state;
Run;
Proc sort data=two;
By state;
Run;
Proc compare base=one compare=two;
By state;
Title 'Comparing Two Data Sets: based on by variable';
Run;
Proc sort data=one;
By state;
Run;
Proc compare base=one;
By state;
Var grade1;
With grade2;
Title 'Comparing Two variables with in Data Sets';
Run;

Comparing between different variables from both datasets


Proc compare base=one compare=two nosummary;
Var grade1;
With grade2;
Title 'Comparing Variables with Different Names';
Run;

Comparing between different variables with in a dataset


Proc compare base=one nosummary allstats novalues;
Var grade1;
With grade2;
Title 'Comparing Variables within a Data Set';
Run;

Proc compare base=one compare = two listall;


Title 'Comparing Variables within a Data Set';
Run;

Creating a dataset with statistical values

E-Mail: [email protected] Phone: +91-9848733309/+91-9676828080


www.covalentech.com & www.covalenttrainings.com
Proc compare base=one compare=two Outstats=dataset noprint;
Run;

E-Mail: [email protected] Phone: +91-9848733309/+91-9676828080


www.covalentech.com & www.covalenttrainings.com

You might also like