Programming the statistical procedures from SAS

Standered Deviation !

Reply
New Contributor
Posts: 2

Standered Deviation !

s
I have data for credit card customers with their month on month balances ( In columns ) for last 24 month .

This makes my data with 25 column ( 1 card nbr + 24 for balances ).

I want to compute std dev of coumn 1-12 and 13-24 respectively .

Also i want to recompute std dev for columns 1-12 and 13-24 by excluding MAX from each set .

How can i do this ?

Super Contributor
Posts: 490

Re: Standered Deviation !

For the first part of your question:

proc transpose data=have out=long;

   by nbr;

run;

data wide;

set long;

format h $ 5.;

by nbr;

retain c;

retain h;

c=c+1;

if first.nbr then do;

  h="1-12";

  c=1;

end;

else if c >= 13 then h="13-24";

run;

proc means data=wide std ;

class nbr h;

var col1 ;

run;

Esteemed Advisor
Esteemed Advisor
Posts: 6,977

Re: Standered Deviation !

Yes, as mentioned above you want to normalise your data.  This is a method of taking columns and creating records from them.  The opposite is transposed where records are taken and columns created (which you currently have).  Once you have your normalised table you can do the means as above, then with an extra 2 steps:

proc sort data=xyz;

     by nbr descending col1;

run;

data xyz;

     set xyz;

     by nbr;

     if first.nbr then delete;

run;

proc means...

Ask a Question
Discussion stats
  • 2 replies
  • 218 views
  • 1 like
  • 3 in conversation