I've a dataframe where I want to add a new column(newcol) based on the conditionally applying on the others columns(parameter,value). The code has to be written in a way that "if value is not missing then if parameter= "SYSBP" and value >140 and if parameter= "DIABP" and value <80 then newcol="Y". There is no value for else condition, it has to remain blank.
A glimpse of dataset
PATIENT parameter value
001 SYSBP 190
001 DIABP 78
001 SYSBP 180
001 DIABP 72
002 SYSBP NA
002 DIABP NA
002 SYSBP 180
002 DIABP 72
As a SAS programmer, I'm looking for an equivalent to if then statement and I found ifelse() to be the closest one in R, if someone knows a better match for the if then match, then kindly help me know.
Aucun commentaire:
Enregistrer un commentaire