0% found this document useful (0 votes)
104 views2 pages

Candisc Wolves Sas

This document provides an example of performing a canonical discriminant analysis using wolf data to distinguish between four groups: Rocky Mountain females, Rocky Mountain males, Alaskan females, and Alaskan males. It inputs wolf data, creates a variable for the four groups, performs the canonical discriminant analysis to find the canonical variables that best distinguish the groups, and plots the results of the first two canonical variables to visualize group separation.

Uploaded by

dkanand86
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
104 views2 pages

Candisc Wolves Sas

This document provides an example of performing a canonical discriminant analysis using wolf data to distinguish between four groups: Rocky Mountain females, Rocky Mountain males, Alaskan females, and Alaskan males. It inputs wolf data, creates a variable for the four groups, performs the canonical discriminant analysis to find the canonical variables that best distinguish the groups, and plots the results of the first two canonical variables to visualize group separation.

Uploaded by

dkanand86
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

/* -------------------------------------------------* * File: candisc.wolves.

sas * * Example of a Canonical Discriminant Analysis using * the wolves data * * ---------------------------------------------------- */ OPTIONS NOCENTER PAGENO=1 NODATE; /* The first task is to create a variable and a format for each group so that we can plot the results of the canonical analysis. First we will establish the print formats for the groups */ PROC FORMAT; VALUE wolffmt 1='RM Female' 2='RM Male' 3='AR Female' 4='AR Male'; RUN; /* Now we will input the wolves data and create a variable for the four groups NOTE: LIBNAME p7291 must be assigned to runthis code */ *LIBNAME p7291 'path-and-directory-for-this-nickname'; DATA wolves2; SET p7291.wolves; Subject=_n_; * --- create the variable Group; group=1; IF sex='m' THEN group=2; IF location='ar' THEN group=group+2; FORMAT group wolffmt.; RUN; /* Perform the discriminant analysis This will find the three different canonical variables that best distinguish among the four groups. The results will be output to a new data set named "temp" */ PROC CANDISC DATA=wolves2 OUT=temp; VAR x1-x8; CLASS group; RUN; /* proc sort data=temp; by group; run; */ /* --- Plot the four groups on theie values on the first two canonical discriminant function --- */ PROC GPLOT DATA=temp; SYMBOL1 C=black L=1 W=3 I=none V=* H=3; SYMBOL2 C=black L=2 W=3 I=none V=> H=3; SYMBOL3 C=black L=3 W=3 I=none V=X H=3;

SYMBOL4 C=black L=4 W=3 I=none V=Y H=3; PLOT can2*can1=group; RUN; QUIT;

You might also like