Hello again everybody,
For my descriptive statistics section I want to have a pie chart that shows the breakdown of CEO compensation. I have data on everything from salary and bonus, to stock and option awards.
This is what the data look like:
0030B | Gregory S. Daily | 1 | 0 | 0 | 0 | 29716 | IPAYMENT INC | Co-founder, Chairman and Chief Executive Officer | CEO | 708 | 0 | 0 | 0 | 0 | 0 | 16.5 | 724.5 | 708 | 724.5 | 724.5 | 0 | 0 | . | . | . | . | 0 | 0 | 0 | 0 | 50 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 724.5 | 724.5 | 277.6 | -40.379 | -39.182 | -39.182 | -39.182 | -39.182 | -39.182 | 151832 | 14220 | 2010 | 20010201 | . | 20110523 | . | Co-Founder | Daily | Gregory | S. | MALE | Mr. | 57 | 4.63E+97 | OTH | 126 East 56th Street | New York | NY | 10022 | 212-802-7200 | BUSINESS SERVICES, NEC | Financial Transactions Processing, Reserve, and Cl | Data Processing & Outsourced Services | EX | 212 | 522320 | 4510 | 7389 | |||||||||||||||||
0030B | Carl A. Grimstad | 0 | 0 | 0 | 0 | 29717 | IPAYMENT INC | Co-Founder, Chairman, Chief Executive Officer and President | CEO | 1000 | 1000 | 0 | 0 | 0 | 0 | 83.5 | 2083.5 | 2000 | 2083.5 | 2083.5 | 0 | 0 | . | . | . | . | 0 | 0 | 0 | 0 | 43 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2083.5 | 2083.5 | 41.243 | 182.486 | 194.28 | . | . | . | . | 151832 | 28609 | 2011 | 20110523 | . | . | . | CEO | Co-Founder, Chairman, Chief Executive Officer and President | Grimstad | Carl | A. | MALE | Mr. | 49 | 4.63E+97 | OTH | 126 East 56th Street | New York | NY | 10022 | 212-802-7200 | BUSINESS SERVICES, NEC | Financial Transactions Processing, Reserve, and Cl | Data Processing & Outsourced Services | EX | 212 | 522320 | 4510 | 7389 | ||||||||||||||||
0030B | Carl A. Grimstad | 0 | 0 | 0 | 0 | 29717 | IPAYMENT INC | Co-Founder, Chairman, Chief Executive Officer and President | CEO | 1001.605 | 775 | 0 | 0 | 0 | 0 | 182.333 | 1958.938 | 1776.605 | 1958.938 | 1958.938 | 0 | 0 | . | . | . | . | 0 | 0 | 0 | 0 | 44 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1958.938 | 1958.938 | 0.161 | -11.17 | -5.978 | -5.978 | -5.978 | -5.978 | -5.978 | 151832 | 28609 | 2012 | 20110523 | . | . | . | CEO | Co-Founder, Chairman, Chief Executive Officer and President | Grimstad | Carl | A. | MALE | Mr. | 49 | 4.63E+97 | OTH | 126 East 56th Street | New York | NY | 10022 | 212-802-7200 | BUSINESS SERVICES, NEC | Financial Transactions Processing, Reserve, and Cl | Data Processing & Outsourced Services | EX | 212 | 522320 | 4510 | 7389 | ||||||||||||||||
0030B | Carl A. Grimstad | 0 | 0 | 0 | 0 | 29717 | IPAYMENT INC | Co-Founder, Chairman, Chief Executive Officer and President | CEO | 1011.04 | 1200 | 0 | 0 | 0 | 0 | 225.527 | 2436.567 | 2211.04 | 2436.567 | 2436.567 | 0 | 0 | . | . | . | . | 0 | 0 | 0 | 0 | 45 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2436.567 | 2436.567 | 0.942 | 24.453 | 24.382 | 24.382 | 24.382 | 24.382 | 24.382 | 151832 | 28609 | 2013 | 20110523 | . | . | . | CEO | Co-Founder, Chairman, Chief Executive Officer and President | Grimstad | Carl | A. | MALE | Mr. | 49 | 4.63E+97 | OTH | 126 East 56th Street | New York | NY | 10022 | 212-802-7200 | BUSINESS SERVICES, NEC | Financial Transactions Processing, Reserve, and Cl | Data Processing & Outsourced Services | EX | 212 | 522320 | 4510 | 7389 | ||||||||||||||||
0033A | John F. Young | 1 | 0 | 0 | 0 | 38315 | ENERGY FUTURE HOLDINGS CORP | Chief Executive Officer, President, Director, Member of Executive Committee, Member of Governance & Public Affairs Committee, Chief Executive Officer of Energy Future Intermediate Holding Company Llc | CEO | 1200 | 0 | 0 | 3405 | 2043.6 | 2.761 | 210.826 | 6862.187 | 1200 | 6862.187 | 5407.187 | 9905.313 | 13080.659 | 5062.009 | . | 1012.009 | . | 0 | 0 | 600 | 1950 | 54 | 3000 | 3405 | 0 | 3675 | 4200 | 0 | 0 | 0 | 0 | 0 | 0 | 36.074 | 0 | 0 | 0 | 27.686 | 0 | 309.402 | 0 | 1 | 6859.426 | 3454.426 | 20 | 20 | 166.566 | 166.566 | 110.046 | 166.459 | 34.189 | 10507 | 29712 | 2010 | 20080129 | 20080101 | . | . | CEO | Chief Executive Officer, President, Director, Member of Executive Committee, Chief Executive Officer of Energy Future Intermediate Holding Company LLC, Chief Executive Officer of Energy Future Competitive Holdings C | Young | John | F. | MALE | Mr. | 61 | 29299Z00 | OTH | 1601 Bryan Street, Energy Plaza | Dallas | TX | 75201 | 214-812-4600 | ELECTRIC SERVICES | Electric Power Generation, Transmission and Distri | Independent Power Producers & Energy Traders | EX | 214 | 2211 | 5510 | 4911 | ||||||||||||||||
0033A | John F. Young | 1 | 0 | 0 | 0 | 38315 | ENERGY FUTURE HOLDINGS CORP | Chief Executive Officer, President, Director, Member of Executive Committee, Member of Governance & Public Affairs Committee, Chief Executive Officer of Energy Future Intermediate Holding Company Llc | CEO | 1200 | 0 | 5347.5 | 0 | 8468.6 | 3.123 | 105.484 | 15124.707 | 1200 | 15124.707 | 9777.207 | 15305.193 | 21650.965 | 1012.222 | . | 1012.222 | . | 0 | 0 | 0 | 0 | 55 | 6000 | 5347.5 | 0 | 0 | 0 | 0 | 0 | 6000 | 3000 | 0 | 0 | 39.197 | 0 | 0 | 6740.6 | -7.57 | 0 | 7042.432 | 0 | 2 | 15121.584 | 9774.084 | 0 | 0 | 120.407 | 120.407 | 80.819 | 120.45 | 182.944 | 10507 | 29712 | 2011 | 20080129 | 20080101 | . | . | CEO | Chief Executive Officer, President, Director, Member of Executive Committee, Chief Executive Officer of Energy Future Intermediate Holding Company LLC, Chief Executive Officer of Energy Future Competitive Holdings C | Young | John | F. | MALE | Mr. | 61 | 29299Z00 | OTH | 1601 Bryan Street, Energy Plaza | Dallas | TX | 75201 | 214-812-4600 | ELECTRIC SERVICES | Electric Power Generation, Transmission and Distri | Independent Power Producers & Energy Traders | EX | 214 | 2211 | 5510 | 4911 | ||||||||||||||||
0033A | John F. Young | 1 | 0 | 0 | 0 | 38315 | ENERGY FUTURE HOLDINGS CORP | Chief Executive Officer, President, Director, Member of Executive Committee, Chief Executive Officer of Energy Future Intermediate Holding Company Llc, Chief Executive Officer of Energy Future Competitive Holdings Company | CEO | 1200 | 0 | 525 | 0 | 4968 | 4.337 | 72.848 | 6770.185 | 1200 | 6770.185 | 6245.185 | 12733.854 | 17289.516 | 1012.222 | . | 1012.222 | . | 0 | 0 | 0 | 0 | 56 | 0 | 0 | 525 | 0 | 0 | 0 | 0 | 7500 | 3000 | 0 | 0 | 0 | 168.173 | 0 | 2700 | 41.544 | 5990.6 | 3668.736 | 0 | 2 | 6765.848 | 6765.848 | 0 | 0 | -55.238 | -55.238 | -36.125 | -55.257 | -30.778 | 10507 | 29712 | 2012 | 20080129 | 20080101 | . | . | CEO | Chief Executive Officer, President, Director, Member of Executive Committee, Chief Executive Officer of Energy Future Intermediate Holding Company LLC, Chief Executive Officer of Energy Future Competitive Holdings C | Young | John | F. | MALE | Mr. | 61 | 29299Z00 | OTH | 1601 Bryan Street, Energy Plaza | Dallas | TX | 75201 | 214-812-4600 | ELECTRIC SERVICES | Electric Power Generation, Transmission and Distri | Independent Power Producers & Energy Traders | EX | 214 | 2211 | 5510 | 4911 | ||||||||||||||||
0033A | John F. Young | 1 | 0 | 0 | 0 | 38315 | ENERGY FUTURE HOLDINGS CORP | Chief Executive Officer, President, Director, Member of Executive Committee, Chief Executive Officer of Energy Future Intermediate Holding Company LLC, Chief Executive Officer of Energy Future Competitive Holdings Company | CEO | 1350 | 0 | 420 | 0 | 5511.375 | 0 | 73.152 | 7354.527 | 1350 | 7354.527 | 6934.527 | 14177.643 | 17552.643 | 1012.222 | . | 1012.222 | . | 0 | 0 | 0 | 0 | 57 | 0 | 0 | 420 | 0 | 0 | 0 | 0 | 9000 | 0 | 0 | 0 | 0 | 0 | 0 | 2700 | 46.435 | 750 | 5665.171 | 0 | 2 | 7354.527 | 7354.527 | 12.5 | 12.5 | 8.631 | 8.631 | 11.038 | 8.701 | 8.701 | 10507 | 29712 | 2013 | 20080129 | 20080101 | . | . | CEO | Chief Executive Officer, President, Director, Member of Executive Committee, Chief Executive Officer of Energy Future Intermediate Holding Company LLC, Chief Executive Officer of Energy Future Competitive Holdings C | Young | John | F. | MALE | Mr. | 61 | 29299Z00 | OTH | 1601 Bryan Street, Energy Plaza | Dallas | TX | 75201 | 214-812-4600 | ELECTRIC SERVICES | Electric Power Generation, Transmission and Distri | Independent Power Producers & Energy Traders | EX | 214 | 2211 | 5510 | 4911 |
Wow, I wish there was a better way to do that.
Anyway, I found the following code online:
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;
title1 "Types of Vehicles Produced Worldwide";
proc gchart data=sashelp.cars;
pie type / other=0
midpoints="Truck" "SUV" "Sedan" "Wagon" "Sports" "Hybrid"
value=none
percent=arrow
slice=arrow
noheading
plabel=(font='Albany AMT/bold' h=1.3 color=depk);
run;
quit;
I am not really seeing from this example how they incorporate the data from for the pie chart. I can easily replace
data=sashelp.cars;
for
data=paper.compustat_execucomp4
but past that I am a little lost. My experience in data visualization basically consists of scatterplots and histograms thus far, so any help is appreciated!
Thanks as always!
-SAStuck
So I'm looking at this code for reference:
PROC SORT DATA = sashelp.class
OUT = class;
BY age;
RUN;
PROC TEMPLATE;
DEFINE STATGRAPH pie;
BEGINGRAPH;
LAYOUT REGION;
PIECHART CATEGORY = age /
DATALABELLOCATION = OUTSIDE
CATEGORYDIRECTION = CLOCKWISE
START = 180 NAME = 'pie';
DISCRETELEGEND 'pie' /
TITLE = 'Age';
ENDLAYOUT;
ENDGRAPH;
END;
RUN;
PROC SGRENDER DATA = class
TEMPLATE = pie;
RUN;
What is my BY variable? How do I prepare my data for it to work using this kind of code? Not sure where to begin.
That's more complex than you need. Find a SGPLOT example instead.
@sastuck wrote:
So I'm looking at this code for reference:
PROC SORT DATA = sashelp.class OUT = class; BY age; RUN; PROC TEMPLATE; DEFINE STATGRAPH pie; BEGINGRAPH; LAYOUT REGION; PIECHART CATEGORY = age / DATALABELLOCATION = OUTSIDE CATEGORYDIRECTION = CLOCKWISE START = 180 NAME = 'pie'; DISCRETELEGEND 'pie' / TITLE = 'Age'; ENDLAYOUT; ENDGRAPH; END; RUN; PROC SGRENDER DATA = class TEMPLATE = pie; RUN;
What is my BY variable? How do I prepare my data for it to work using this kind of code? Not sure where to begin.
How do you figure it out? You run the code in the example and look at the source data. Then you map it back to your data, so match the variables in the example to yours, which are the measures being presented, which are the BY variables that map to your data. Then you change the code accordingly.
Having trouble finding any examples online of a pie chart with proc sgplot. I'll keep looking
My bad, SGPLOT doesn't seem to support some Pie Charts, but GTL does. But rather than work with GTL you can use some macros that someone has prebuilt found here:
https://blogs.sas.com/content/graphicallyspeaking/2012/08/26/how-about-some-pie/
My issue here:
%GTLPieChartMacro(data=GTL_Sedans, category=type, response=count,
title=Share of Market for Sedans, startangle=340,
DataLabelFontSize=12, responselabel=true,
percentlabel=false);
Is that my CEO compensation is not a variable segregated by categories but rather different variables for each measure of compensation, so salary, bonus, stock options, and so on.
So how are you planning to show that in a single pie chart?
@sastuck wrote:
My issue here:
%GTLPieChartMacro(data=GTL_Sedans, category=type, response=count, title=Share of Market for Sedans, startangle=340, DataLabelFontSize=12, responselabel=true, percentlabel=false);
Is that my CEO compensation is not a variable segregated by categories but rather different variables for each measure of compensation, so salary, bonus, stock options, and so on.
That's a great question! So what I need is precisely that? If I want to show the composition of the average CEO's salary then I need the variable "components" and then an average for each of the components? Should I do this in a datastep?
@Reeza , so in order to get this pie chart I need a variable that consists of the different average values which will make up the pie "slices," yes? I know how to compute the averages, but how do I create a variable that consists of just those values so that I can do the pie chart? Here's where i'm at:
libname practice "~/425/425_Final_Paper";
*import compustat dataset;
PROC IMPORT out=practice.CompuStat_Execucomp
datafile="~/425/425_Final_Paper/CompuStat_Execucomp.csv" DBMS=CSV replace;
getnames=yes;
guessingrows=2000;
run;
proc contents data=practice.CompuStat_Execucomp;
run;
proc means data=practice.CompuStat_Execucomp;
var salary;
output out=avg mean=avg_salary;
run;
proc means data=practice.CompuStat_Execucomp;
var bonus;
output out=avg mean=avg_bonus;
run;
proc means data=practice.CompuStat_Execucomp;
var option_awards;
output out=avg mean=avg_optionawards;
run;
Again, I want to show the composition of CEO compensation, broken down into just these three or maybe 4 or 5 (if I include other measure) categories.
The data set outputted by PROC MEANS (AVG) is what you would use then.
If you used the same PROC MEANS code three times with three different variables - no need for this by the way - then you're overwriting your output each time. If you comment your code you can avoid logical errors like this.
The code example I posted in your other questions illustrates how to get a data set with the amounts summarized in a data set.
Are you referring to this?
proc format;
value age_group
low - 13 = 'Pre-Teen'
13 - 15 = 'Teen'
16 - high = 'Adult';
run;
title 'Example of an applied format';
proc print data=sashelp.class;
format age age_group.;
run;
data class;
set sashelp.class;
age_category = put(age, age_group.);
label age_category = 'Age Category';
run;
title 'Example of creating a new variable with the format';
proc print data=class;
run;
No, the one where you asked what feature1-feature3 is. That code, clearly states applied formats to get summaries.
Your problem here is getting the output summary into a data set for multiple variables at once rather than multiple calls..
proc means data=practice.CompuStat_Execucomp noprint;
by ;
var avg_salary avg_bonus avg_optionawards;
output out=practice.compensation_pie median= var= mean= /autoname;
run;
Am I getting close?
You're probably missing something in your BY statement.
That controls what levels you want the results at, ie groups the results by sex, gender, position.
I'd probably try it and see if it give's you the desired results. If not, try changing things.
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.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.