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

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!

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
  • 559 views
  • 0 likes
  • 2 in conversation