Sunteți pe pagina 1din 4

Partea I si II

LIBNAME sem_sas 'Z:\E\SAS\Date';

PROC IMPORT OUT=date


DATAFILE='Z:\E\SAS\Date\Date.xlsx'
/* DBMS=xls */
replace;
GETNAMES=yes;
RUN;

PROC MEANS DATA=date;


RUN;

PROC CORR DATA=date;


RUN;
proc univariate data=date;
histogram;
run;

Partea III
LIBNAME sem_sas 'Z:\E\SAS\Date';

PROC IMPORT OUT=Date


DATAFILE='Z:\E\SAS\Date\Date.xlsx'
/* DBMS=xls */
replace;
GETNAMES=yes;
RUN;

PROC STANDARD DATA=Date MEAN=0 STD=1 OUT=zdate;


VAR Population Land_area GDP_based_on_PPP_valuation
Annual_real_GDP_growth;
RUN;

PROC MEANS DATA=zdate;


RUN;

proc univariate data=zdate;


title 'Analiza statistica a fiecarei variabile';
var Population Land_area GDP_based_on_PPP_valuation Annual_real_GDP_growth
;
run;
ODS GRAPHICS ON;

PROC PRINCOMP DATA=zdate COV OUT=Scoruri N=4 OUTSTAT=rez_ACP plots=(all);


VAR Population Land_area GDP_based_on_PPP_valuation
Annual_real_GDP_growth;
TITLE 'Rezultate Analiza Componentelor Principale';
run;

proc corr data=Scoruri outp=rez_corr;


var Population Land_area GDP_based_on_PPP_valuation
Annual_real_GDP_growth;
with prin1,prin2,prin3;
run;

OPTIONS FORMCHAR="|----|+|---+=|-/\<>*";

PROC PLOT DATA=scoruri;


PLOT PRIN2*PRIN1='*' $ Name_of_Country;
RUN;

DATA scoruri_hq; /*Grafic de o rezolutie


superioara.*/
SET scoruri; /* Plecam de la fisierul
Scoruri. */
X=PRIN1; /* Redenumim componentele
principale Prin1 si Prin 2, in X si Y.*/
Y=PRIN2;
TEXT=Name_of_Country; /*Textul care va aparea
pe grafic este denumirea firmei*/
SIZE=1; /*Dimensiunea textului.*/
XSYS='2'; /*Pentru a pune denumirile
firmelor (Text) en (x,y)*/
YSYS='2';
LABEL Y='AXA 2' /*Etichetele axelor*/
X='AXA 1';
KEEP X Y XSYS YSYS TEXT SIZE; /* Pastram doar variabilele care ne sunt
utile*/
RUN;

TITLE 'Primul plan principal'; /*Titlul graficului.*/


PROC GPLOT DATA=scoruri_hq;
PLOT Y*X=1 / ANNOTATE=scoruri_hq HREF=0 VREF=0;
RUN;
QUIT;
TITLE 'Matricea scorurilor';
PROC PRINT DATA=scoruri;
RUN;

TITLE 'Statistici calculate pentru componentele principale';


PROC PRINT DATA=rez_ACP;
RUN;
ODS GRAPHICS OFF;

PROC MEANS DATA=date N STD MEAN MAXDEC=2;


VAR Population Land_area GDP_based_on_PPP_valuation
Annual_real_GDP_growth ;
RUN;

VI. Cluster
LIBNAME sem_sas 'Z:\E\SAS\Date';

PROC IMPORT OUT=date


DATAFILE='Z:\E\SAS\Date\Date.xlsx'
/* DBMS=xls */
replace;
GETNAMES=yes;
RUN;

ods graphics on;


OPTIONS FORMCHAR="|----|+|---+=|-/\<>*";
/*Efectum gruparea n clustere, prin metoda lui Ward*/
PROC CLUSTER DATA=date MEthOD=WARD ccc STANDARD pseudo
OUTTREE=date_clus print=20;
title 'Analiza claselor - Pregatirea datelor';
VAR Population Land_area GDP_based_on_PPP_valuation Annual_real_GDP_growth;
RUN;

/*Recuperm rezultatele precedente pentru a construi gruparea n


clase(ncluster=3
precizeaz c dorim s obtinem 3 clase)COPY efectueaza copierea variabilelor
roa, roe
etc., n fisierul REZULTATE*/
PROC TREE DATA=date_clus OUT=REZULTATE NCLUSTERS=2;
title ' Dendrograma ';
COPY Population Land_area GDP_based_on_PPP_valuation Annual_real_GDP_growth;
RUN;

/* Recalculm componentele principale, pentru a putea desena primul plan


principal,
vizualiznd cele 3 clase calculate mai nainte.*/
PROC PRINCOMP DATA=REZULTATE OUT=rez_acp;
title ' Analiza componentelor principale ';
VAR Population Land_area GDP_based_on_PPP_valuation Annual_real_GDP_growth;
RUN;

/* Crem fisierul 'Grafic', care permite personalizarea graficului*/


DATA grafic;
SET rez_acp;
X=PRIN1;
Y=PRIN2;
TEXT=_NAME_;
*/Contine numrul firmei: n grafic, va aprea scris 'OB1, OB2, ..., OB101'*/
SIZE=1;
XSYS='2';
YSYS='2';
IF CLUSTER=1 THEN COLOR='GREEN'; /*Culori diferite pentru fiecare cluster*/
IF CLUSTER=2 THEN COLOR='RED';

LABEL Y='AXA 2'


X='AXA 1';
KEEP X Y XSYS YSYS TEXT SIZE CLUSTER COLOR;
RUN;

TITLE 'Evidentierea claselor in raport cu primele doua componente


principale';
PROC GPLOT DATA=grafic;
PLOT Y*X=CLUSTER / ANNOTATE=grafic HREF=0 VREF=0;
RUN;

V. Analiza discriminant
proc discrim data=date outstat=StatCer
method=normal pool=yes
list crossvalidate;
class Gradul_de_dezvoltare_umana;
priors prop;
var Population Land_area GDP_based_on_PPP_valuation
Annual_real_GDP_growth;
title2 'Utilizarea functiei discriminante liniare';
run;