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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 819 views
  • 1 like
  • 3 in conversation