cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
mmkaz
Level II

Maintaining "empty spaces" in resulting column after using if formula

Hey everyone,

I'm pretty new to jmp, so I might seem a little off with what I am asking and probably I won't use the correct terminology, but anyways I m rather despaired because I cannot think of a solution to my problem: 
Let me describe my situation shortly: So I am a student and I am currently working on a set of data. I am looking at adverse drug effects of certain medication and the effect I'm looking at right now is "erectile dysfunction", I got data from baseline and data for 4 weeks, 12 weeks etc. etc., which means I got a column "erectile dysfunction 4wk", "erectile dysfunction baseline" etc. 
I added a new column called "new onset erectile dysfunction 4 wk", which means I am looking at those, who developed the adverse effect after e.g.  4 weeks, filtering out those who got them at baseline and still got them after 4 weeks - irrespectively from the given medication. In short: I am trying to focus on the incidence of erectile dysfunction after 4 weeks to approximate a drug induced effect. 

I used a formula that looks like that:

For Each Row(
	:"new on-set erectile dysfunction 4 WK: y/n "n = If( 
		:"erectile dysfunction Base y/n"n == "n" & :"erectile dysfunction 4 WK: y/n"n
		== "y"
	, 
		"y"
	, 
		"n"
	)
);


My problem is that by using that formula, jmp replaces my empty values with "n", and I cannot think of any way to modify my formula so that empty spaces remain empty. 

Bildschirmfoto 2021-07-06 um 16.56.28.png

First column is "erectile dysfunction baseline", second is "erectile dysfunction 4wk" and third one is "new-onset erectile dysfunction 4wk".
So I hope anyone can help. Thank you!

 

4 REPLIES 4
txnelson
Super User

Re: Maintaining "empty spaces" in resulting column after using if formula

Your JSL is setting the the value to

     "n"

so one option is to set it to

     ""

For Each Row(
	:"new on-set erectile dysfunction 4 WK: y/n "n = If( 
		:"erectile dysfunction Base y/n"n == "n" & :"erectile dysfunction 4 WK: y/n"n
		== "y"
	, 
		"y"
	, 
		""
	)
);

or after looking at your data, the checking on the value of erectile dysfunction Base y/n being a blank might be what you want

For Each Row(
	:"new on-set erectile dysfunction 4 WK: y/n "n = If( 
		(:"erectile dysfunction Base y/n"n == "n" |
			:"erectile dysfunction Base y/n"n == "" ) & 
			:"erectile dysfunction 4 WK: y/n"n
		== "y"
	, 
		"y"
	, 
		"n"
	)
);
Jim
mmkaz
Level II

Re: Maintaining "empty spaces" in resulting column after using if formula

Thank you very much!! Your reply helped me a lot.
Thierry_S
Super User

Re: Maintaining "empty spaces" in resulting column after using if formula

Hi,

I think you may have over-engineered your formula:

First, you do not need to specify For Each Row in a column formula: JMP processes each row separately by default

Second, if I understand correctly the syntax of your formula, I think it may be simplified as a column formula as shown below.

Third, because Empty text values are evaluated as NOT "y" and NOT "n", JMP evaluates your formula as "n", so here is a possible solution to your problem.

(Note: I did not use your specific column headings but you can replace those easily in the formula editor).

If(
	:BASELINE == "n" & :Week 4 == "y", "y",
	Is Missing( :BASELINE ) | Is Missing( :Week 4 ), .,
	"n"
)

Best,

TS

Thierry R. Sornasse
mmkaz
Level II

Re: Maintaining "empty spaces" in resulting column after using if formula

Wow that makes a lot of sense! Yea I was actually struggling with finding an efficient way to write the formula, but much thanks to you!!