Simple statistics
This example reads an Excel file stored in a web server and automatically produces a series of simple statistics that will be written in the Output area.
In order to run this example just paste the following statements in the Command area and press the execute button. To view the content of the original data set just go in the PATH tab and refer to the one named Cars.
This example reads an Excel file stored in a web server and automatically produces a series of simple statistics that will be written in the Output area.
In order to run this example just paste the following statements in the Command area and press the execute button. To view the content of the original data set just go in the PATH tab and refer to the one named Cars.
Proc Excel2dict outdict=cars; xlsfile C:\Temp\cars.xls; sheet 0; rowlabel 0; run; Dictionary dict=cars out=cars; description Characteristics of New Car Models in 1993; keyword Example data set; run; /*A preliminary frequencies table*/ Proc Freq dict=Cars out=Frequencies; varrow v2; varcol v15; vargroup v25; totalonrows ; totaloncols ; replace all; run; DICTIONARY dict=work.frequencies; description Car and transmission types (for US domestic or not manifacturer); writefmt g_v25=NUMI; writefmt rowtotal_1=NUMI; writefmt rowtotal_2=NUMI; run; /*Here a new variable is added: the price for each horsepower (the ratio betweeen the price and the horsepower*/ dataset dict=cars out=cars; newvar ratio=num; ratio=v3/v12*1000; run; /*Set up the label of the new variable ratio*/ dictionary dict=cars out=cars; label ratio=Price (in $) for each horsepower; run; /*An attempt to see what are the most convenient cars, according to their type*/ Proc Univariate dict=Cars out=statistic; var v3 v7 ratio; vargroup v2; statistic MEAN; outstyle aggreg; run; /*Some cosmetic changes to the output statistics*/ DICTIONARY dict=work.Statistic; description Several statistics for the cars according to their type; writefmt v0=NUMD2; writefmt v1=NUMD2; writefmt v2=NUMD2; run; /*Here is evaluated the correlation matrix*/ Proc Corr dict=Cars out=corr; varrow v3 v6 v7 v12 v13 v14; run; /*Some cosmetic changements for the correlation matrix*/ dictionary dict=corr out=corr; description Correlation matrix; writefmt v_v3=numd2; writefmt v_v6=numd2; writefmt v_v7=numd2; writefmt v_v12=numd2; writefmt v_v13=numd2; writefmt v_v14=numd2; run; EXPORTDS2OUT Frequencies; EXPORTDS2OUT Statistic; EXPORTDS2OUT Corr; |