SAS Programming - calculations on class Interval based data


How do we input and run procedures
 on a class interval based data for example

Class Interval                             Frequency
    0-2                                              1
    3-5                                              3

etc. If I want to run proc Univariate on this to calculate basic stats
then how will I do that

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

First, I would create a variable which would indicated which interval you wanted

In your example

if classinterval < 3 then classind = 1; else
if classinterval < 6 then classind  = 2;    /* etc */

If you have a lot of these, I would recommend the SELECT statement

SELECT (Classinterval);

when (0..2) classind=1;
when (3..5) classind=2;

Then run proc univariate with the classification variable indicated.

anshumaEngineeringAuthor Commented:
I am sorry but I couldn't figure it out. Could please send me the code

This is the data

0-2      1
3-5      3
6-8      5
9-11      4
12-14      2

I tried creating the following code

data temp1;
set sasuser.EX3_29;

CLASS classind;

EX3_29 is the sasdata set with following properties

-----Alphabetic List of Variables and Attributes-----
# Variable Type Len Pos Label
1 Class_Interval Char 255 8 Class_Interval
2 Frequency Num 8 0 Frequency

I do not think that I understand the problem.  If your data only consists of class interval and frequency, what stats are you hoping to produce?

The thought the problem was that you had data on some measure like taxes, for example and you class interval was based on, say, income class and you wanted to know averages, totals, etc of tax by income class.

From your reply, its sounds like frequencies have already be calculated for your classes and you are not interested in any other variable, so I am not sure where you are going from here.

If I have a better understanding, I am confident that I can help.

-- tobydavid

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
anshumaEngineeringAuthor Commented:
I am sorry for being so late. I hope that you won'd mind this. I will post the question soon albeit with more explaination.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.