/*Kaz's SAS juku course*/ /*www.estat.us*/ /*Kaz's SAS juku*/ /*www.estat.us*/ /*Reporting results of your analysis*/ /*assigning nick names to directories*/ libname kaz_home "c:/temp/"; /*Reading a permanent data and creating a temporary data*/ data ABC; set sashelp.Shoes; run; proc means data=ABC; title "Boring way of presentation"; class Product; var Sales Inventory Returns; run; /*let's try something more exciting and analytical*/ ods listing close; proc means data=ABC mean max min std stderr n; title "Boring way of presentation"; class Product; var Sales Inventory Returns; ods output summary=results_in_here; run; ods listing; proc print data=results_in_here; title "Look inside this result data set and think how you want to cook them to stimulate analysitical thinking"; run; /*Usually I am thiking a. what is my purpose? b. how can I make it easy for people (old people with reading glasses) to understand it. Well, in fact I am not. I am used to it, so I just do it without thinking. I sort of let my intuition do the work. And I just see if it works or not. If it works, fine. If not, I let my intuition work more. Maybe this is one style of doing things. Or perhaps this stuff is complicated enough, I cannot really predict what happens at each step. */ /*ADD description of results using a data step in this way*/ data results_in_here; set results_in_here; /*create some description*/ if Returns_Mean > 4000 then remark="Good job!"; /*I often use asterisks to indicate things like statistical significance*/ /*Here I just show how I do it, though it is not about statistical significance*/ length remark2 $ 5; if Returns_Mean < 1000 then remark2="+"; if Returns_Mean >= 1000 and Returns_mean < 2000 then remark2="*"; if Returns_Mean >= 2000 and Returns_mean < 3000 then remark2="**"; if Returns_Mean >= 3000 then remark2="****"; /*I use below to add statistical significance sign when doing regression sign=' '; if probt < 0.1 then sign='+'; if probt < 0.05 then sign='*'; if probt < 0.01 then sign='**'; if probt < 0.001 then sign='***'; if probt < -999 then sign=" "; *//*maybe I don't need this line*/ run; /*I want to sort product names by the return value (how much it earned)*/ proc sort data=results_in_here out=results_in_here; by Returns_Mean; run; proc print data=results_in_here round noobs; title "Now it is more meaningful"; var Product NObs Returns_Mean Returns_StdDev Remark remark2 ; footnote "You can also add a footnote like this"; run; title ""; /*you do this so the title won't be used in the next table*/ footnote "";/*same reason*/ /*And then save this as an excel sheet*/ ods html file="c:/temp/example.xls"; proc print data=results_in_here round noobs; title "Now it is more meaningful"; var Product NObs Returns_Mean Returns_StdDev Remark remark2 ; footnote "You can also add a footnote like this"; run; title ""; /*you do this so the title won't be used in the next table*/ footnote "";/*same reason*/ ods html close; /*And then save this as an RTF file*/ ods rtf file="c:/temp/example.rtf"; proc print data=results_in_here round noobs; title "Now it is more meaningful"; var Product NObs Returns_Mean Returns_StdDev Remark remark2 ; footnote "You can also add a footnote like this"; run; title ""; /*you do this so the title won't be used in the next table*/ footnote "";/*same reason*/ ods rtf close;