BookmarkSubscribeRSS Feed
AKSHAYMOGHE
Calcite | Level 5

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 ?

2 REPLIES 2
mohamed_zaki
Barite | Level 11

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;

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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...

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1423 views
  • 1 like
  • 3 in conversation