Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73256

Help Formatting Table with Multiple Variables

$
0
0
Hello everyone,

I am trying to create a table which in includes the frequency of college majors in a campus program . Each person can select multiple majors, so there are dummy variables for each. I only want to display the number and percentage.

This code produces the exact look I would like. The label name and values are on the same row. However the values are not what I need.

Code:
dtable m_fin m_gen m_his m_und
Array

Instead, I would like these values (frequency, and the percentage of sample of chose the major) in this picture.
Array

I used the index to calculate the percent and only show the "yes (1)" responses. However I would like everything to be on the same row and eliminate the "1".
Code:
dtable i1.m_fin i1.m_gen i1.m_his i1.m_und
I am not sure what I am missing.Thank you for any help!

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input float(m_fin m_gen m_his m_und)
1 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 0
0 0 0 1
0 0 0 1
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 1 0 0
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 1
0 0 0 0
1 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 1 0
0 0 0 0
0 0 0 0
0 0 0 1
0 0 0 1
0 0 0 1
1 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
0 0 0 1
0 0 0 1
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 0
end

label var m_fin   "Finance"
label var m_gen "Genetics"
label var m_his   "History"
label m_und      "Undecided"

Viewing all articles
Browse latest Browse all 73256

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>