BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
1 REPLY 1

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 551 views
  • 0 likes
  • 2 in conversation