DATA Step, Macro, Functions and more

data set with variances from different files

Reply
N/A
Posts: 0

data set with variances from different files

I want to calculate the variance and the sum of the squared deviations expressed in average observation unit (sd) (basically variance with mean in stead of df as divisor) for different files and then combine all these measures into one file which contains all the variances and one file that contains all the sd

so for instance from the next three files

code....a1.....a2......a3
1.........1.......0.2.....0.4
1.........0.8....0.2.....0.4
1.........0.8....0.2.....0.3
1.........0.9....0.2.....0.4

code...a1.....a2.....a3.....a4
2........1.......0.2....0.4....0.2
2........0.8....0.1....0.4....0.1
2........0.9....0.2....0.4....0.1
2........0.9....0.2....0.4....0.1

code....a2.....a3.....a5
3.........0.2....0.4....0.5
3.........0.2....0.3....0.6
3.........0.3....0.3....0.5
3.........0.2....0.4....0.5

I want to create two new files, one with the variances and one with sd, so


title=variance

code...a1.........a2.........a3.........a4.........a5....
1........0.009.....0.000.....0.003........................
2........0.007.....0.003.....0.000....0.003............
3.....................0.003.....0.003................0.002

and

title=sd

code...a1.........a2.........a3.........a4.........a5....
1........0.031.....0.000.....0.020........................
2........0.022.....0.043.....0.000....0.060............
3.....................0.033.....0.029................0.014

I tried to do this with proc means, but that only supports variance and in vardef= mean is not a valid option. Another problem that i am facing is the fact that i have about 5000 files which all have a different number of variables, which is the reason why manual is not an option.

I am a total SAS rookie and I am struggling with it for a while now, so any suggestions would be very welcome
PROC Star
Posts: 1,760

Re: data set with variances from different files

Posted in reply to deleted_user
post only once please.
Ask a Question
Discussion stats
  • 1 reply
  • 112 views
  • 0 likes
  • 2 in conversation