Help using Base SAS procedures

How to group similiar values together in SAS

Reply
Contributor
Posts: 59

How to group similiar values together in SAS

I have a numeric variable which has a range. The variable also has some special values like -999984. Is there a way I can get descriptive statistics on this variable based on automatic groups of 10 set by SAS. for ex:

Groups N Mean Minimum Maximum
-999994 - 0 45
1-3 123
4-9 23

Thanks
Tej
Super Contributor
Super Contributor
Posts: 3,174

Re: How to group similiar values together in SAS

Posted in reply to tejeshwar
SAS PROC FORMAT is one option to generate a list of value ranges associated with some descriptive relationship. Then use PROC SUMMARY/MEANS to summarize the FORMATTED CLASS variable.

Scott Barry
SBBWorks, Inc.
Contributor
Posts: 59

Re: How to group similiar values together in SAS

Posted in reply to tejeshwar
Proc Format is one of the option, however in that case I will need to see range of every variable and create these groups manually. Since I am dealing with 250 variables and every single one of them has a different range, so this is something I am hoping to avoid.

Something that I am hoping is if SAS can decide these groups by itself depending upon the range and then I can summarize it.

I am sure there might be a way, however just I am not able to figure it out by myself.
Super Contributor
Super Contributor
Posts: 3,174

Re: How to group similiar values together in SAS

Posted in reply to tejeshwar
Look at using PROC SUMMARY to generate the MIN and MAX in a new file. Then MERGE that file back onto your original file. Then using a DATA step, increment in a DO loop from your new TO variables BY 10, creating another new variable which you will then use to run your descriptive statistics.

You may also find the SAS support website http://support.sas.com/ useful with its own SEARCH facility (SAS DOC and technical papers are hosted there), and possibly using the Google advanced search argument below (one one of your own):

generate descriptive statistics value ranges site:sas.com


Scott Barry
SBBWorks, Inc.
Contributor
Posts: 59

Re: How to group similiar values together in SAS

Posted in reply to tejeshwar
Possibly in case you have a sample code, that should be helpful

Tej
Ask a Question
Discussion stats
  • 4 replies
  • 110 views
  • 0 likes
  • 2 in conversation