BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi Guys,

Sorry for another pretty newbie post but this situation really stumps me.

I was given data and asked to create relative frequency charts, which I did as you can see from the code.

However, I was also asked to create a Pie chart in which I would have to display the relative frequency (which is percent=inside, not a problem) as well as the average age given a one of the variables (sex, marital status, country, size type) and the standard deviation of the ages.

Basically, the pie charts I have now show what my professor wants but I would also need to show another variable, age, and its mean and standard deviation. I've been looking through the help file for hours and am stumped. Any help would be met with much joy and great appreciation!


data Preference;
input Sex $ MaritalStatus$ Age Country $ Size $ Type $;
datalines;
Male Married 34 American Large Family
Male Single 36 Japanese Small Sporty
Male Married 23 Japanese Small Family
Male Single 29 American Large Family
Male Married 39 American Medium Family
Male Single 34 Japanese Medium Family
Female Married 42 American Large Family
Female Married 40 European Medium Family
Male Married 28 American Medium Sporty
Female Married 26 American Medium Family
Female Married 26 European Small Sporty
Male Single 26 European Medium Sporty
Female Married 37 American Medium Sporty
Male Single 25 Japanese Small Sporty
Female Single 27 Japanese Medium Family
Male Married 41 American Large Family
Male Single 35 American Small Sporty
Male Single 23 American Medium Work
Male Married 28 Japanese Small Family
Male Married 38 European Medium Family
;
run;

proc means data= Preference n mean std;
var Age;
class Sex;
title Descriptive Statistics for Sex based on Age;
run;

proc means data= Preference n mean std;
var Age;
class MaritalStatus;
title Descriptive Statistics for Marital Status based on Age;
run;

proc means data= Preference n mean std;
var Age;
class Country;
title Descriptive Statistics for Country based on Age;
run;

proc means data= Preference n mean std;
var Age;
class Size;
title Descriptive Statistics for Size based on Age;
run;

proc means data= Preference n mean std;
var Age;
class Type;
title Descriptive Statistics for Type of Car based on Age;
run;

proc print noobs data= Preference;
var Sex MaritalStatus Age Country Size Type;
title Car Preferences for 20 Observations;

run;

proc freq data=Preference ;
tables Sex MaritalStatus Country Size Type/ nocum;
title Frequency Tables for Car Preference Observations;

run;

proc gchart data= Preference;
pie Sex / Percent=inside Discrete Value=inside noheading;
title Sex of the Observations;

run;

proc gchart data= Preference;
pie MaritalStatus / Percent=inside Discrete Value=inside noheading;
title MaritalStatus of the Observations;

run;

proc gchart data= Preference;
pie Country / Percent=inside Discrete Value=inside noheading;
title Country of origin for the Observations;

run;

proc gchart data= Preference;
pie Size / Percent=inside Discrete Value=inside noheading;
title Size of the Observations;

run;

proc gchart data= Preference;
pie Type / Percent=inside Discrete Value=inside noheading;
title Type of car for the Observations;
run;


Thanks much again,
Henry
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
There is a separate forum for SAS/GRAPH and ODS GRAPHICS questions and you might want to post this question over there.
http://support.sas.com/forums/forum.jspa?forumID=51

cynthia

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 648 views
  • 0 likes
  • 2 in conversation