---
# System prepended metadata

title: Untitled

---

TP 2 Stat des

Question 2
PROC FORMAT LIBRARY=resultat;
VALUE NOMTRANCHE
	LOW - 17 = "Enfants"
	18 - 25 = "Etudiants"
	26 - 39 = "Jeunes actifs"
	40 - 54 = "Actifs"
	55 - 65 = "Actifs expérimentés"
	65 - 79 = "Jeunes seniors"
	80 - HIGH = "Seniors";
VALUE $NOMSEXE
	"1"="Homme"
	"2"="Femme";
RUN;

Question 3
OPTION FMTSEARCH=(work resultat source);
DATA resultat. Rp12_d35;
SET resultat.Rp12_d35;
FORMAT AGE NOMTRANCHE.;
RUN;

Question 4
PROC CONTENTS DATA= source. Rp12_d35;
RUN;

Question 4bis
PROC FORMAT LIBRARY=source FMTLIB;
RUN;

Question 5
PROC CATALOG c=source. formats;
CONTENTS stat;
RUN;

Question 6
PROC FREQ DATA= resultat. Rp12_d35;
TABLE age*tact;
FORMAT AGE NOMTRANCHE.
	TACT $NOMTACT.;
WEIGHT ipondi;
RUN;

Question 7
PROC FREQ DATA= resultat. Rp12_d35;
TABLE age*tact / OUT = resultat. table_contingence;
FORMAT AGE NOMTRANCHE.
	TACT $NOMTACT.;
WEIGHT ipondi; 
RUN;

PROC PRINT DATA= resultat. table_contingence;
RUN;

Question 8
PROC TRANSPOSE DATA= resultat. table_contingence OUT= resultat. vraie_table_contingence (drop=_name_ _label_);
BY age;
VAR count;
ID tact;
RUN;

Question 8bis
PROC FREQ DATA= resultat. Rp12_d35;
TABLE age*tact / NOCOL NOFREQ
FORMAT AGE NOMTRANCHE.
	TACT $NOMTACT.;
WEIGHT ipondi; 
RUN;

Question 9
PROC FREQ DATA= resultat. Rp12_d35;
TABLE age*tact / CHISQ;
FORMAT AGE NOMTRANCHE.
	TACT $NOMTACT.;
WEIGHT ipondi;
RUN;

Question 10
PROC TABULATE DATA= resultat. RP12_d35;
TABLES (age all)*sexe, tact *IPONDI* (SUM='Effectif pondéré');
FORMAT age NOMTRANCHE.
	sexe $NOMSEXE.
	tact $NOMTACT.;
VAR ipondi;
CLASS age sexe tact;
RUN;

Question 11
PROC TABULATE DATA= resultat. RP12_d35 OUT= resultat. table_crois1;
TABLES (age all)*sexe, tact *IPONDI* (SUM='Effectif pondéré');
FORMAT age NOMTRANCHE.
	sexe $NOMSEXE.
	tact $NOMTACT.;
VAR ipondi;
CLASS age sexe tact;
RUN;

Exercice 2

Question 1
proc contents data=source. fqp;
run;

Question 2
PROC FREQ DATA=source.fgp(keep= CFfils CSpere) NLEVELS;
RUN;

Question 3
PROC FORMAT;
VALUE $CS
	"CS1" ="Agriculture"
	"CS2"= "Artisan"
	"CS3"= "Cadre et PIS"
	"CS4"= "Profession intermédiaire"
	"CS5"= "Employé"
	"CS6" = "Ouvrier";
RUN;

OPTIONS FMTSEARCH = (work source resultat);

Question 4 
PROC FREQ DATA=resultat. fqp;
TABLE CSfils*CSpere / nopercent norow nofreq format=10.;
FORMAT CSfils $CS.
	CSper $CS.;
WEIGHT poids;
RUN;

PROC FREQ DATA=resultat. fqp;
TABLE CSfils*CSpere /norow nofreq;
FORMAT CSfils $CS.
	CSper $CS.;
WEIGHT poids;
RUN;

Question 5 
PROC FREQ DATA=resultat. fqp;
TABLE CSfils*CSpere / CHISQ;
FORMAT CSfils $CS.
	CSper $CS.;
WEIGHT poids;
RUN;