BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Khaladdin
Quartz | Level 8

I want to give the value for some specific rows. I think showing it by example would be better. I have following datasheet;

 Date                 Value
01/01/2001          10
02/01/2001          20
03/01/2001          35
04/01/2001          15
05/01/2001          25
06/01/2001          35
07/01/2001          20
08/01/2001          45
09/01/2001          35

My result should be:

 Date                 Value    Spec.Value
 01/01/2001          10        1
 02/01/2001          20        1
 03/01/2001          35        1
 04/01/2001          15        2
 05/01/2001          25        2
 06/01/2001          35        2
 07/01/2001          20        3
 08/01/2001          45        3
 09/01/2001          35        3

As you can see, my condition value is 35. I have three 35. I need to group my date by using this condition value.

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

I haven't run this, as not typing in that test data.  For future reference post test data in the form of a datastep:

data want;
  set have;
  retain spec_value 1;
  output;
  if value=35 then spec_value=sum(spec_value,1);
run;

View solution in original post

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

I haven't run this, as not typing in that test data.  For future reference post test data in the form of a datastep:

data want;
  set have;
  retain spec_value 1;
  output;
  if value=35 then spec_value=sum(spec_value,1);
run;
Khaladdin
Quartz | Level 8
Many thank. It works:)
Reeza
Super User

@Khaladdin Please mark the question answered. 

Khaladdin
Quartz | Level 8
I accept the answer as a right answer. Is that enough? @Reeza

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1269 views
  • 1 like
  • 3 in conversation