I’ve created the following 4 indicator variables from a survey where interviewees looked at both financial - and environmental data and then had to report whether each data type had a minor - or major impact on their decisions (code pasted below):
- env1 – indicates that environmental data in the case study had only a minor impact on the interviewee
- env2 – indicates that environmental data in the case study had a major impact on the interviewee
- fin1 — indicates that financial data in the case study had only a minor impact on the interviewee
- fin2 – indicates that financial data in the case study had a major impact on the interviewee
Array
However, I would like to make the following changes:
- I want the financial data (both the count of minor and major impact) to be in blue and the minor data (both the count of minor and major impact) to be in red.
- In the legend, I would like a blue and red box indicating financial and environmental data respectively.
- I want the two "major impact" counts on the left with a single title underneath saying "major impact" and the two "minor impact" counts on the right with a single title underneath saying "minor impact".
- I would like the major impact bars to be separated by a small gap from the minor impact bars.
Thanks!
Current Code:
gen impact_env_data_major=2 if AI=="Major impact on my investment decision"
replace impact_env_data_major=0 if impact_env_data_major==.
gen impact_env_data_minor=1 if AI=="Minor impact on my investment decision"
replace impact_env_data_minor=0 if impact_env_data_minor==.
gen impact_env_data=impact_env_data_major+impact_env_d ata_minor
drop impact_env_data_major impact_env_data_minor AI
gen impact_fin_data_major=2 if Thefourcasestudiesyoujusts=="Major impact on my investment decision"
replace impact_fin_data_major=0 if impact_fin_data_major==.
gen impact_fin_data_minor=1 if Thefourcasestudiesyoujusts=="Minor impact on my investment decision"
replace impact_fin_data_minor=0 if impact_fin_data_minor==.
gen impact_fin_data=impact_fin_data_major+impact_fin_d ata_minor
drop impact_fin_data_major impact_fin_data_minor Thefourcasestudiesyoujusts
tabulate impact_env_data, generate(env)
label variable env1 "Minor Impact (Environmental)"
label variable env2 "Major Impact (Environmental)"
tabulate impact_fin_data, generate(fin)
label variable fin1 "Minor Impact (Finanicial)"
label variable fin2 "Major Impact (Finanicial)"
graph bar (rawsum) fin1 env1 fin2 env2, legend(label(1 "`: var label fin1'" ) label(2 "`: var label env1'" ) label(3 "`: var label fin2'" ) label(4 "`: var label env2'" ))
drop env1 env2 fin1 fin2
0 Response to Organising 4 Groups of Count Data into 2 Categories
Post a Comment