DATA Step, Macro, Functions and more

newbie stuck at square 1

Posts: 21

newbie stuck at square 1

I need help with the following question, please. I have no idea where to start


The number of hours of the college students aged 18 to 24 years spending online in a typical week was interested in to a researcher. Suppose that the number of hours spending online is normal distributed with mean of 28 and standard deviation of 5.6.  
Use appropriate Functions in SAS to answer the following questions. 
Find the probability that a college student aged 18 to 24 years, selected at random, spends between 20 and 35 hours online each week.  Determine the proportion of college students aged 18 to 24 years who spend more than 40 hours online per week.

Respected Advisor
Posts: 3,294

Re: newbie stuck at square 1

This is a relatively basic statistics question, the kind you would be asked in statistics 101.


If you know how to do this using pencil and paper and a table of the normal distribution, then the method in SAS simply replaces the table of the normal distribution with a function in SAS. The SAS function you would want to use is the PROBNORM function.


And if you don't know how to do this using pencil and paper, then you need to first learn the basics of the normal distribution, any introductory textbook will do.

Paige Miller
Posts: 1,411

Re: newbie stuck at square 1

Just to get you started, you are looking for the shaded area under the curve plotted like this


data PDF;
do hours = 8 to 48 by 0.05;
   Y = pdf("Normal", hours, 28, 5.6);

   if hours <= 35 then upper = Y;else upper = 0;
   if hours <= 20 then lower = Y; else lower = 0;


/* First Question */
title 'Density of Hours Spent online';
title2 '18 to 24 year olds';
proc sgplot data = PDF noautolegend;
   series x = hours y = Y;
   band x = hours lower = lower upper = upper;

   xaxis label = 'Hours Spent';
   yaxis label = 'Density';
Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation