// //summary command // //This command is calculation summary or average by each category //(Catuiton) //If explanation variable is numeric,variable is categorized automatically. //Syntax without explanation variable sumup [targets]; //Syntax with explanation variable sumup [target] by [explanation]; //Syntax used options sumup [target] by [explanation]/ options ; //Options [variable]:code //when variable type is numeric code,you have to define code. [variable]:continuous //when numeric type, you donnot need to define explicitly. [variable]:moji //when character type, you donnot need to define explicitly. [variable]:zero //if define zero,summary at zero value category. [variable]:format=[filename] //if you define format file,you can categorize by format. method=sum //calculate summary by category(default) method=average //calculate mean by category //Eample1 without option //Read bond option data which has amount and return value on expire data. get bond.csv@;
//Summary amount by return rate whose type is number. //return rate is categorized automatically. sumup amount by rtnrate;
get freq@ana; //Since category name is too long, cut category name for plot label. label=strsel(rtnrate,1,3); //Plot amount by return rate label. plot bar amount by label;
//Example 2 Comparison iris species by their property. //Read iris data. get irisR.csv@;
//Get average by Species. sumup SepalL SepalW PetalL PetalW by Species/ method:average ;
//Plot property of iris by species. get freq@ana; plot bar SepalL SepalW PetalL PetalW by Species;
//Example 3 with 2 explanation variable //Read 22157 record of risk data which are discriminated by default flag and custom segment. get free.csv@;
//Convert def and segNo type as code to summary division. attr name type/ def:code segNo:code ;
//Execute mean of risk by each segNo. sumup risk by def segNo/ method:average ;
//Divide data by def value. get freq@ana; if(def == "0") { outrec def0; } else { outrec def1; } //Rename risk name to risk0. get def0; rename risk=risk0;
//Merge def0 and def1 by segNo. and rename risk to risk1. merge def1 by segNo; rename risk=risk1;
//Plot risk by def and segNo. plot bar risk1 risk0 by segNo;
risk is different with default flag.