BookmarkSubscribeRSS Feed
RandyStan
Fluorite | Level 6

Dear All

 

I want to split my data into deciles but not counting the lowest value into the decile grouping

 

So my data is as follows

 

VARA

0

2

4

0

6

7

0

5

1

So the data should be grouped by deciles but 0 should be omitted in the calculation of deciles

VARA   Decile_Group

0               0

2

4

0               0

6

7

0              0

5

1       

 

And the remaining data can be grouped by deciles.

 

Please help

Thanx so much

Randy       

2 REPLIES 2
Patrick
Opal | Level 21

Did you already see this discussion? I believe @PGStats answer there is what you need.

ChrisNZ
Tourmaline | Level 20

Like this?

data HAVE; 
 do I=0 to 100;
   output; 
  end; 
run;

proc rank data=HAVE(where=(I ne 0)) groups=9 out=RANK; 
  var I; 
  ranks GRP ;
run;
 
data WANT;
  set HAVE(where=(I eq 0))
      RANK(in=RANKED);
  GRP=sum(GRP,1)*RANKED;
run;

 

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 464 views
  • 0 likes
  • 3 in conversation