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

Is this possible in EC? If something changes in the test result, it must continue to give the value "semi_start" within the test number in the column EG_RESULT

 

See example:


Thank you very much for the comments

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

@HansSteenhuis 

Just a SAS datastep creating the data is easiest for "us". I'm using SAS on a remote server and though would have to upload any SAS file prior to using it. 

Below Have table created via the EG import wizard.

DATA have;
    LENGTH
        TESTNUMBER         8
        DATE               8
        RESULT           $ 4
        EG_RESULT        $ 10 ;
    FORMAT
        TESTNUMBER       BEST12.
        DATE             DATE9.
        RESULT           $CHAR4.
        EG_RESULT        $CHAR10. ;
    INFORMAT
        TESTNUMBER       BEST12.
        DATE             DATE9.
        RESULT           $CHAR4.
        EG_RESULT        $CHAR10. ;
    INFILE DATALINES4
        DLM='7F'x
        MISSOVER
        DSD ;
    INPUT
        TESTNUMBER       : BEST32.
        DATE             : BEST32.
        RESULT           : $CHAR4.
        EG_RESULT        : $CHAR10. ;
DATALINES4;
112520870GOODstart
112520909GOODstart
112520940GOODstart
112521027GOODstart
112521109GOODstart
112521250GOODstart
112521361GOODstart
112521465GOODstart
112521549GOODstart
112521654GOODstart
112521703GOODstart
254820979GOODstart
254821026GOODstart
254821066GOODstart
254821158GOODstart
254821448XXXsemi_start
254821466XXXsemi_start
254821515XXXsemi_start
254821594XXXsemi_start
254821647XXXsemi_start
254821469GOODsemi_start
254821496GOODsemi_start
254821556GOODsemi_start
;;;;

data want;
  set have;
  by testnumber result notsorted;
  length eg_result2 $10;
  retain eg_result2;
  if first.testnumber then eg_result2='start';
  else if first.result then eg_result2='semi_start';
run;

proc print data=want noobs;
run;

Capture.JPG 

View solution in original post

4 REPLIES 4
Patrick
Opal | Level 21

Yes, it is possible.

 

Please provide more detail like sample data (not just a screenshot) and desired result. Below some guidelines how to ask a question which helps us to help you.

https://communities.sas.com/t5/Getting-Started/How-to-get-fast-helpful-answers/ta-p/226133 

HansSteenhuis
Calcite | Level 5

Thanks for your comment. I have added an excel file.

HansSteenhuis
Calcite | Level 5

I have just added a sas table as an example 🙂

 

Patrick
Opal | Level 21

@HansSteenhuis 

Just a SAS datastep creating the data is easiest for "us". I'm using SAS on a remote server and though would have to upload any SAS file prior to using it. 

Below Have table created via the EG import wizard.

DATA have;
    LENGTH
        TESTNUMBER         8
        DATE               8
        RESULT           $ 4
        EG_RESULT        $ 10 ;
    FORMAT
        TESTNUMBER       BEST12.
        DATE             DATE9.
        RESULT           $CHAR4.
        EG_RESULT        $CHAR10. ;
    INFORMAT
        TESTNUMBER       BEST12.
        DATE             DATE9.
        RESULT           $CHAR4.
        EG_RESULT        $CHAR10. ;
    INFILE DATALINES4
        DLM='7F'x
        MISSOVER
        DSD ;
    INPUT
        TESTNUMBER       : BEST32.
        DATE             : BEST32.
        RESULT           : $CHAR4.
        EG_RESULT        : $CHAR10. ;
DATALINES4;
112520870GOODstart
112520909GOODstart
112520940GOODstart
112521027GOODstart
112521109GOODstart
112521250GOODstart
112521361GOODstart
112521465GOODstart
112521549GOODstart
112521654GOODstart
112521703GOODstart
254820979GOODstart
254821026GOODstart
254821066GOODstart
254821158GOODstart
254821448XXXsemi_start
254821466XXXsemi_start
254821515XXXsemi_start
254821594XXXsemi_start
254821647XXXsemi_start
254821469GOODsemi_start
254821496GOODsemi_start
254821556GOODsemi_start
;;;;

data want;
  set have;
  by testnumber result notsorted;
  length eg_result2 $10;
  retain eg_result2;
  if first.testnumber then eg_result2='start';
  else if first.result then eg_result2='semi_start';
run;

proc print data=want noobs;
run;

Capture.JPG 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1430 views
  • 0 likes
  • 2 in conversation