But in the output for mid variable all the fileds with 1 are appearing and fields with 0 are appearing missing values.
Inorder to evade this I have used options missing ="0"
No, it means you have missing values not 0, which indicates something is wrong with your code. Fix your IF/THEN statement as indicated by @Astoundingso you get 0's not missing values.
Else if missing( brand) then mid =0;
If you have many of these types of operations to do you might consider a custom informat.
proc format library=work; invalue missingtext . = 0 other=1; run; data example; x= ' '; yx=input(x,missingtext.); z='anything'; yz=input(z,missingtext.); run;
This informat looks at an input string, if it is missing then the result is 0 anything else is 1. Even if the input string has a leading blank the result is one.
For your use then you would have
NOTE this works if you are interested in knowing that your variable has some text.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.