/******************************************************************************
 * Programme : Controlar el orden de clasificación en un informe de frecuencia
 * Reference : CONTRODCE2
 * Source    : https://www.wearecas.eu/en/sampleCode/CONTRODCE2
 ******************************************************************************/

/* --- BLOC 1 --- */
title "Ordered by Unformatted Values of TYPE (default)";
proc freq data=sashelp.cars;  /*1*/
    tables type;             
run;

/* --- BLOC 2 --- */
title "Ordered by Descending Frequency of TYPE";
proc freq data=sashelp.cars order=freq;  /*2*/
    tables type;             
run;

/* --- BLOC 3 --- */
proc format;      /*3*/                      
    value FuelEff low-20="Low"
                  20<-30="Mid"
                  30<-high="High";
run;

/* --- BLOC 4 --- */
title "Ordered by Unformatted Values of MPG_Highway";
proc freq data=sashelp.cars;     /*4*/
    tables MPG_Highway;
    format MPG_Highway FuelEff.;
run;

/* --- BLOC 5 --- */
title "Ordered by Formatted Values of MPG_Highway";
proc freq data=sashelp.cars order=formatted;       /*5*/
    tables MPG_Highway;
    format MPG_Highway FuelEff.;
run;

/* --- BLOC 6 --- */
title "Ordered by Descending Frequency of Formatted values of MPG_Highway";
proc freq data=sashelp.cars order=freq;       /*6*/
    tables MPG_Highway;
    format MPG_Highway FuelEff.;
run;

