/*Hi SAS Forum, Could you please help me on this. I have the below dataset which shows the age and outstanding balance of 3 customers*/ data have_1; input acct_num age balance_due; cards; 111 72 5009 222 24 10001 333 19 6150 ; run; /*Q: I want to generate a SAS dataset ("a SAS data set" is emphazised again) like below where values for "Min", "Max" and "Mean" fields, all should have rounded values without any decimals. And when the field called Variable_name gets a value of balance_due, then the values for fields called Min, Max and Mean should get a $ sign prefixed with '000 separator. */ /*Answer*/ /* Variable_name Min Max Mean age 19 72 38 balance_due $5,009 $10,001 $7,053 */ /*I attmepted below code but it generates below SAS dataset which is not acceptable cos age cannot get $ values.*/ /* variable_Name MIN MAX MEAN age $19 $72 $38 balance_due $5,009 $10,001 $7,053 */ /*Below is my code*/ proc means data=have_1 min max mean maxdec=0; var age balance_due ; output out=have_2; run; /*Preparing for transposing the proc means output*/ data have_3; set have_2; if _stat_ in ('N' 'STD') then delete; drop _type_ _freq_ ; run; /*transposing the proc means output*/ proc transpose data=have_3 out=rotated_dataset name=variable_Name; id _stat_; run; /*Formatting only values in balance_due variables to dollars */ data want; set rotated_dataset; /*Formatting only values in balance_due variables to dollars */ if variable_Name ='balance_due' then do; format min max mean dollar12.; end; run; /*Mirisa*/
... View more