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          35My 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        3As you can see, my condition value is 35. I have three 35. I need to group my date by using this condition value.
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;
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 Please mark the question answered.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.
