Posts

Showing posts with the label ? or ?? format Modifiers

THE SPECIAL “??” FORMAT MODIFIER

The following excerpt is from SAS OnlineDoc documentation: ? or ?? Direct link: http://www.nesug.org/Proceedings/nesug01/at/at1013.pdf The optional question mark (?) and double question mark (??) format modifiers suppress the printing of both the error messages and the input lines when invalid data values are read. The ? modifier suppresses the invalid data message. The ?? modifier also suppresses the invalid data message and, in addition, prevents the automatic variable _ERROR_ from being set to 1 when invalid data are read. Below is an example of using ?? to determine whether a variable contains non-numeric values or not: data _null_; x = “ 12345678 ”; if (input (x, ?? 8. ) eq . ) then put ‘ non-numeric’ ; else put ‘numeric’ ; run ; Running SAS would return “Numeric” in the above example. If we used X=”123a5678”, SAS would return “Non-Numeric”. Note that the input format in the above example is “8.” So only the first 8 bytes of the character string are checked...