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


Hello-

I am trying to determine if a patient can be classified as 'GLAU'  There are a total of five tests a patient may be given and any 'y' would classify the patient as GLAU.   The data looks like below.   I've been writing separate if then statements for each test and was wondering if there is an easier way to write code.  Any help would be appreciated. 

patientinner_eye_pressureoptic_nervefield_visioniris_corneacornea
15385y y
15953 yy
14385y y
15996 y
15335yy
15004 y
15843 y
15385 y
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

I was too lazy to type out the variables but the whichc function will work.

You could also nest it into an ifc function if you wanted a oneliner piece of code, but more ppl understand this, I find.

if whichc('y', var1, var2, var3, var4, var5)>0 then classify="GLAU";

else classify = "Other"

View solution in original post

1 REPLY 1
Reeza
Super User

I was too lazy to type out the variables but the whichc function will work.

You could also nest it into an ifc function if you wanted a oneliner piece of code, but more ppl understand this, I find.

if whichc('y', var1, var2, var3, var4, var5)>0 then classify="GLAU";

else classify = "Other"

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 784 views
  • 0 likes
  • 2 in conversation