Greetings,
I'm running Stata 15.1 on OSX. I'd like to create a variable that stores the (separate) means of 4 different ordinal variables. If still unclear: once the variable is created and tabulated, I expect to see something like:
4.57
3.29
2.22
5.43
In attempting to create this variable, I tried the following:
Stata returns the following error message:
The rowmean function would simply create an average of the 4 variables, which is not what I want. Any help here would be much appreciated. Thanks!
Example data:
I'm running Stata 15.1 on OSX. I'd like to create a variable that stores the (separate) means of 4 different ordinal variables. If still unclear: once the variable is created and tabulated, I expect to see something like:
4.57
3.29
2.22
5.43
In attempting to create this variable, I tried the following:
Code:
egen sample_means=mean(intlwhts intlblks intlasns intlhsps)
intlwhtsintlblksintlasnsintlhsps not found
Example data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(intlwhts intlblks intlasns intlhsps) 4 4 4 4 6 2 7 3 6 5 6 5 4 4 4 4 5 4 4 3 5 4 7 5 2 3 1 4 6 6 6 6 4 3 4 3 4 4 4 4 5 3 3 2 6 6 6 6 4 4 4 4 4 4 4 4 5 4 6 4 4 4 2 6 4 4 4 4 4 4 4 4 5 5 5 5 7 7 7 7 7 3 4 4 5 4 5 4 7 3 7 3 3 2 3 3 4 4 4 4 5 4 6 4 4 4 5 4 4 5 4 4 4 4 4 4 5 5 4 5 4 4 4 4 5 6 7 5 5 3 5 2 6 5 7 6 7 7 7 7 6 4 5 4 3 3 2 2 6 5 7 5 6 5 6 6 6 6 6 6 5 5 5 5 5 3 3 4 7 3 6 6 6 4 6 5 4 4 4 4 5 4 6 4 4 4 4 4 4 4 4 4 4 4 5 4 6 6 6 6 4 4 6 4 5 3 6 4 4 4 7 4 4 4 4 4 5 5 5 5 5 5 7 4 6 2 7 4 5 5 2 5 5 5 6 5 4 3 6 4 5 5 5 5 5 4 6 4 7 4 4 4 4 4 4 4 6 5 7 6 6 6 4 4 5 3 5 4 5 6 7 6 4 4 4 4 6 5 6 5 6 4 6 4 4 4 4 4 5 5 5 5 6 5 6 6 7 3 4 5 4 4 3 4 5 4 6 5 5 4 5 4 3 4 4 4 5 5 5 5 5 2 7 2 6 4 7 4 5 5 5 5 5 4 4 5 4 4 4 4 2 4 2 3 6 4 6 5 7 5 5 7 4 4 4 4 6 4 7 2 5 3 3 3 4 4 4 4 4 3 5 4 5 4 5 4 7 6 7 6 5 7 7 5 5 4 4 3 7 4 6 5 7 7 7 7 6 6 6 6 end
Comment