Does anyone know whether SAS store the current setting created by using the MISSING statement?
The MISSING statement is different than the MISSING= option. Then MISSING= option controls how missing values are displayed. You can use the GETOPTION() function to retrieve the current setting.
The MISSING statement determines which single letter text strings numeric inputs will treat as representing the corresponding special missing value. So using:
missing AB ;
input num ;
Will read "A" and "B" as meaning .A and .B, but treat "C" and "D" as invalid values that generate an error.
If SAS does not store this somewhere that can be retrieved here is a data step than can create a macro variable with the list.
data _null_;
missing='_ABCDEFGHIJKLMNOPQRSTUVWXYZ';
do i=1 to 27;
if .=input(char(missing,i),??1.) then substr(missing,i,1)=' ';
end;
call symputx('missing',compress(missing));
run;
Example:
2681 missing azybc; 2682 data _null_; 2683 missing='_ABCDEFGHIJKLMNOPQRSTUVWXYZ'; 2684 do i=1 to 27; 2685 if .=input(char(missing,i),??1.) then substr(missing,i,1)=' '; 2686 end; 2687 call symputx('missing',compress(missing)); 2688 run; NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 2689 2690 %put &=missing; MISSING=ABCYZ
If SAS does not store this somewhere that can be retrieved here is a data step than can create a macro variable with the list.
data _null_;
missing='_ABCDEFGHIJKLMNOPQRSTUVWXYZ';
do i=1 to 27;
if .=input(char(missing,i),??1.) then substr(missing,i,1)=' ';
end;
call symputx('missing',compress(missing));
run;
Example:
2681 missing azybc; 2682 data _null_; 2683 missing='_ABCDEFGHIJKLMNOPQRSTUVWXYZ'; 2684 do i=1 to 27; 2685 if .=input(char(missing,i),??1.) then substr(missing,i,1)=' '; 2686 end; 2687 call symputx('missing',compress(missing)); 2688 run; NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 2689 2690 %put &=missing; MISSING=ABCYZ
Interesting, the missing statement "is global in scope" (the docs say so), but it seems that there is no view in sashelp storing the value. For other global statements, like title, filename, ... views exist. Seems as someone forgot to implement this, or i need to look closer.
IMO, the MISSING statement should be deprecated and replaced by an INMISSING option.
@Kurt_Bremser wrote:
IMO, the MISSING statement should be deprecated and replaced by an INMISSING option.
Well, but the "inmissing" option is no in the docs and at with m5 i get
ERROR 13-12: Unrecognized SAS option name INMISSING.
That's why I said an INMISSING option, and not the INMISSING option. Such an option would need to be created. I should have written "replaced by a future INMISSING option" for clarity.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.