El script utiliza el procedimiento `PROC PRINT` para mostrar listas de datos de la tabla `sashelp.Orsales`. Se utilizan varias opciones, como el filtrado con `WHERE`, la suma de variables numéricas con `SUM` y la personalización de los encabezados. El procedimiento `PROC SORT` también se emplea para reorganizar los datos según diferentes criterios de ordenación, ascendentes y descendentes. El script también muestra cómo añadir títulos y notas al pie a los informes.
Análisis de datos
Type : SASHELP
Los datos provienen exclusivamente de la tabla `sashelp.Orsales`, que es una tabla de ejemplo estándar proporcionada con SAS.
1 Bloque de código
PROC PRINT
Explicación : Este bloque muestra las variables `product_Group`, `Quantity` y `Total_Retail_Price` de la tabla `sashelp.Orsales`. También calcula y muestra la suma total de `Total_Retail_Price`.
¡Copiado!
proc print data= sashelp.Orsales;
var product_Group Quantity Total_Retail_Price;
sum Total_Retail_Price;
run;
1
PROC PRINTDATA= sashelp.Orsales;
2
var product_Group Quantity Total_Retail_Price;
3
sum Total_Retail_Price;
4
RUN;
2 Bloque de código
PROC PRINT
Explicación : Muestra las variables `product_Group`, `Quantity` y `Profit` para las observaciones donde el `Profit` es superior a 2000.
¡Copiado!
proc print data= sashelp.Orsales;
var product_Group Quantity Profit;
where Profit >2000 ;
run;
1
PROC PRINTDATA= sashelp.Orsales;
2
var product_Group Quantity Profit;
3
where Profit >2000 ;
4
RUN;
3 Bloque de código
PROC PRINT
¡Copiado!
proc print data= sashelp.Orsales noobs;
var product_Group Quantity Profit;
where Profit >2000 ;
run;
1
PROC PRINTDATA= sashelp.Orsales noobs;
2
var product_Group Quantity Profit;
3
where Profit >2000 ;
4
RUN;
4 Bloque de código
PROC PRINT
¡Copiado!
proc print data= sashelp.Orsales noobs;
where Quarter= '2000Q1' and Profit >2000 ;
where same and Product_Category = 'Clothes';
run;
1
PROC PRINTDATA= sashelp.Orsales noobs;
2
where Quarter= '2000Q1' and Profit >2000 ;
3
where same and Product_Category = 'Clothes';
4
RUN;
5 Bloque de código
PROC PRINT
¡Copiado!
proc print data= sashelp.Orsales noobs;
where Quarter= '2000Q1' ;
id Year;
var product_Group Quantity Profit;
run;
1
PROC PRINTDATA= sashelp.Orsales noobs;
2
where Quarter= '2000Q1' ;
3
id Year;
4
var product_Group Quantity Profit;
5
RUN;
6 Bloque de código
PROC SORT
¡Copiado!
proc sort data= sashelp.Orsales;
by Profit;
run;
1
PROC SORTDATA= sashelp.Orsales;
2
BY Profit;
3
RUN;
7 Bloque de código
PROC SORT
¡Copiado!
proc sort data= sashelp.Orsales;
by Year descending Profit;
run;
1
2
PROC SORT
3
DATA= sashelp.Orsales;
4
BY Year descending Profit;
5
RUN;
6
8 Bloque de código
PROC SORT
¡Copiado!
proc sort data= sashelp.Orsales;
by Year;
sum Profit;
var Quarter Total_Retail_Price;
run;
1
PROC SORTDATA= sashelp.Orsales;
2
BY Year;
3
sum Profit;
4
var Quarter Total_Retail_Price;
5
RUN;
9 Bloque de código
PROC SORT
¡Copiado!
proc sort data= sashelp.Orsales;
by Year descending Profit;
/*where Total_Retail_Sales >40000*/
run;
1
PROC SORTDATA= sashelp.Orsales;
2
BY Year descending Profit;
3
/*where Total_Retail_Sales >40000*/
4
RUN;
10 Bloque de código
Instrucciones globales
¡Copiado!
title1 'Orion Star Report';
title2 'Profit Report';
footnote1 'confidential';
1
title1 'Orion Star Report';
2
title2 'Profit Report';
3
footnote1 'confidential';
4
11 Bloque de código
PROC PRINT
¡Copiado!
proc print data= sashelp.Orsales label;
var Year product_Group Quantity Profit Total_Retail_Price;
label product_group='Product'
Total_Retail_Price='Total Retail Price';
run;
1
PROC PRINTDATA= sashelp.Orsales label;
2
var Year product_Group Quantity Profit Total_Retail_Price;
3
label product_group='Product'
4
Total_Retail_Price='Total Retail Price';
5
RUN;
12 Bloque de código
Instrucciones globales
¡Copiado!
title;
footnote;
1
title;
2
footnote;
Este material se proporciona "tal cual" por We Are Cas. No hay garantías, expresas o implícitas, en cuanto a la comerciabilidad o idoneidad para un propósito particular con respecto a los materiales o el código contenidos en este documento. We Are Cas no es responsable de los errores en este material tal como existe ahora o existirá, ni We Are Cas proporciona soporte técnico para el mismo.
SAS y todos los demás nombres de productos o servicios de SAS Institute Inc. son marcas registradas o marcas comerciales de SAS Institute Inc. en los EE. UU. y otros países. ® indica registro en los EE. UU. WeAreCAS es un sitio comunitario independiente y no está afiliado a SAS Institute Inc.
Este sitio utiliza cookies técnicas y analíticas para mejorar su experiencia.
Saber más.