BookmarkSubscribeRSS Feed
teja5959
Fluorite | Level 6

Data Have ;

sub           no          stdt                           dtc                          epoch                                           

101           1          2021-06-22              2021-06-17         SCREENING                                     

101           2          2021-06-22              2021-06-22         SCREENING

101           3          2021-06-22             2021-07-06          BLINDED TREATMENT

 

102           1        2021-07-12               2021-06-14          SCREENING

102           2        2021-07-12               2021-07-26          BLINDED TREATMENT

102           3       2021-07-12                2021-07-26          BLINDED TREATMENT

 

I want data 

sub           no          stdt                           dtc                          epoch                                  flg

101           1          2021-06-22              2021-06-17         SCREENING                             ""

101           2          2021-06-22              2021-06-22         SCREENING                             Y

101           3          2021-06-22             2021-07-06          BLINDED TREATMENT            ""

 

102           1        2021-07-12               2021-06-14          SCREENING                             Y

102           2        2021-07-12               2021-07-26          BLINDED TREATMENT            ""

102           3       2021-07-12                2021-07-26          BLINDED TREATMENT            ""

 

4 REPLIES 4
ballardw
Super User

What are the rules involved?

 


@teja5959 wrote:

Data Have ;

sub           no          stdt                           dtc                          epoch                                           

101           1          2021-06-22              2021-06-17         SCREENING                                     

101           2          2021-06-22              2021-06-22         SCREENING

101           3          2021-06-22             2021-07-06          BLINDED TREATMENT

 

102           1        2021-07-12               2021-06-14          SCREENING

102           2        2021-07-12               2021-07-26          BLINDED TREATMENT

102           3       2021-07-12                2021-07-26          BLINDED TREATMENT

 

I want data 

sub           no          stdt                           dtc                          epoch                                  flg

101           1          2021-06-22              2021-06-17         SCREENING                             ""

101           2          2021-06-22              2021-06-22         SCREENING                             Y

101           3          2021-06-22             2021-07-06          BLINDED TREATMENT            ""

 

102           1        2021-07-12               2021-06-14          SCREENING                             Y

102           2        2021-07-12               2021-07-26          BLINDED TREATMENT            ""

102           3       2021-07-12                2021-07-26          BLINDED TREATMENT            ""

 


 

tarheel13
Rhodochrosite | Level 12

is it the last non missing screening visit? 

ballardw
Super User

@tarheel13 wrote:

is it the last non missing screening visit? 


Do you have any missing "Epoch" values? (If that is how to tell if a visit is screening or not)

 

s_lassen
Meteorite | Level 14

If what you want is to flag the screenings that come before another instance (g.e. blinded tratment), it can be done like this:

data want;
  set have;
  by sub epoch notsorted;
  if last.epoch and not last.sub and epoch='SCREENING' then
    flag='Y';
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
  • 4 replies
  • 2741 views
  • 1 like
  • 4 in conversation