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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 4 replies
  • 804 views
  • 1 like
  • 3 in conversation