turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- what is the process to group the observations

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-11-2015 07:52 AM

Hi all,

i have data set contain the variables emp_id, and salaries.

assume there will be 2000 records. emp_id are different and salaries are changed based upon their positions. salaries are min 10000 and maximum 500000.

devide this salaries into 10 groups then each group contain the salaries of 1000000. i.e. if the first ten members salary is equals to 10 lakhs then we want the output as.

sum of value count(persons)

1000000 10

1000000 15

note:we don't take salaries between 1 and 10 lakh. we need the sum of persons salaries sum equals to 10 lakh.

in the second observation also same. The first case who are considered in the second record those persons are not considered. There are remaining of who we are considered in first observation.

like 10 groups we need. how this process is done in sas.

if you know please comment..

Thanks in advance.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Ravikumarkummari

02-11-2015 08:20 AM

Hi,

Perhaps some test data/required output would make your request clearer as I don't quite follow why you get two results? As for grouping, well, you can use datastep with by group processing, proc means/summary/freq. The way I tend to do grouping is:

proc sql;

create table WANT as

select SALARY,

COUNT(distinct PERSON) as COUNT_PERSON

from HAVE

group by SALARY

having SALARY=100000;

quit;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-11-2015 01:13 PM

its not group by salary. the salaries are different manner in this data.

if the sum of 20 persons is 1000000 then those are in one group.

and the remaining persons salaries equals to 100000 then those are second group. the first group persons are not included in second group.

like wise all the persons are covered.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Ravikumarkummari

02-11-2015 01:30 PM

Is the order of the original data of any importance to this process?

Is the 100000 group total: 1) exactly 1000000, 2) less than or equal to 1000000 but within a fixed difference (such as 999785 is within 500 of 1000000), 3) within some fixed amount of 100000, plus or minus some value.

What if after grouping to 1000000 you don't have 10 groups?

Is there a minimum number of people that must be in each group? A maximum?

You need to provide some data to show what this means:

we don't take salaries between 1 and 10 lakh. we need the sum of persons salaries sum equals to 10 lakh.

in the second observation also same. The first case who are considered in the second record those persons are not considered. There are remaining of who we are considered in first observation.

like 10 groups we need. how this process is done in sas.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to ballardw

02-11-2015 02:30 PM

yes there is a lot of importance . its not exactly 10 lakh. its near to 10 lakh and also more than 10 lakh also but not exceeding . means below 10 lakh ok and above also ok. after grouping i need count of employees. This is for analysis purpose.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Ravikumarkummari

02-11-2015 01:39 PM

If you have SAS/OR, then check out SAS/OR(R) 9.3 User's Guide: Mathematical Programming

If you don't, you probably need data step/array loop. Either way you want to provide some mocked data for people to work on if you need specific SAS code instead of general guidance.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Ravikumarkummari

02-12-2015 12:33 AM

if any one know the answer please post how to by group the observations based on some value

here the value is 1000000. the sum of the employee salaries equals to 10 lakh. then

displays 10lakh count(no of employes)

like wise the total data is covered. Based on 10 lakh i need groups its not between the 10 lakh its the sum of all the persons.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Ravikumarkummari

02-12-2015 03:54 AM

I have provided code above which covers your request to "group the observations based on some value here the value is 1000000". Without further information, test data in, required output, and clarification of what the logic actually is, I don't see how further code can be provided?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Ravikumarkummari

02-12-2015 04:07 AM

post your sample data , and the output . You should know there might not be exactly be " the sum of persons salaries sum equals to 10 lakh" . if their salary is different .