I do not understand what you want, please describe in much more detail.
On your first observation the value of South is 2 and of North is 4. The mean of 2 and 4 is exactly 3. So why do you have 3.57... as the mean on that observation?
If you want to treat North and South as the same variable then make them the same variable.
First let's convert your LISTING into an actual DATASET.
data have;
input id South North east west ;
cards;
1 2 4 12 9
2 3 . 11 10
3 2 4 12 10
4 6 4 13 12
;
One way to make NORTH/SOUTH and EAST/WEST into the same variables is to just stack the two together.
proc sql;
select mean(north_south) as mean_north_south
, mean(east_west) as mean_east_west
from
(select north as north_south
, east as east_west
from have
union all
select south as north_south
, west as east_west
from have
);
quit;
Result:
mean_north_ mean_east_
south west
--------------------------
3.571429 11.125
But if you really have 500 variables that is going to extremely painful to code in PROC SQL.
Why not just fix the data structure first. Then it will be easier.
proc transpose data=have out=tall;
by id;
var south -- west ;
run;
proc format ;
value $nsew
'North','north','South','south'='North-South'
'East','east','West','west'='East-West'
;
run;
proc means data=tall mean std;
class _name_;
format _name_ $nsew.;
var col1;
run;
Result
The MEANS Procedure
Analysis Variable : COL1
NAME OF
FORMER N
VARIABLE Obs Mean Std Dev
--------------------------------------------------
North-South 8 3.5714286 1.3972763
East-West 8 11.1250000 1.3562027
--------------------------------------------------
... View more