Forum

Write M Code to Rep...
 
Notifications
Clear all

Write M Code to Replace "null" to "Missing" base on another Variable

3 Posts
2 Users
0 Reactions
172 Views
(@socheatly)
Posts: 2
New Member
Topic starter
 

Dear All,

I had a problem regarding to M code.

I want to know how can I write M code for identify "null" value and replace to "Missing" value base on another question.

Example: question1 and question2 below:

-If question1 answer 1 then question2 (replace "null" to "Missing")

-If question1 answer 2 then question2="null"

Thanks by advance for your help

 

Best regard,

Socheat

 
Posted : 09/06/2020 9:35 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Socheat,

Welcome to our forum.

It's difficult to be exact without seeing your data, but I would add a conditional column that returns either 'Missing' or 'null' based on the questions and answers you define in your logical tests. You can then delete the column containing the nulls you wanted to replace.

If you're still stuck, please provide a sample file so we can see what you're referring to and clarify what you want as your end result.

Mynda

 
Posted : 10/06/2020 1:35 am
(@socheatly)
Posts: 2
New Member
Topic starter
 

Hi Mynda,

Thanks by advance for your recommendation.

In fact, it is very useful.

Now, I could solve this problem according to your recommendation.

I do not have any data yet.

It is my real plan to clean my data in the future.

 

Your sincerely,

Socheat

 
Posted : 10/06/2020 3:43 am
Share: