Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Missing Value Code

Status
Not open for further replies.

DQR

Technical User
Dec 18, 2002
30
GB

How do I tell SAS to read a character other than a period as a missing value when reading from as ASCII file please? The character I want to interpret as a missing value is an asterisk, so the data looks like this:

1 43 6 23
2 31 3 *
3 * 3 7
etc

I can't find this in the manuals or the online help, though I don't doubt that it's there somewhere: my apologies for having to ask.

Cheers,
David
 
It is not a good idea to use * in most of the language. It usually has special meanings. You might want to replace the '*' with any letters a-z, and add a statement:

options missing=a;

or right before a data step, add:

missing a;
data temp;
...
 
SAS provides their menu online for free, you have to apply to get access though.

Here is the link for online menu:

"Option missing = a;" changes the default printed missing value to a. It does not change input format.

Here is what SAS says:
The MISSING= system option allows you to specify a character to be printed when numeric variables contain ordinary missing values (.). If your data contain characters that represent special missing values, such as a or z, do not use the MISSING= option to define them; simply define these values in a MISSING statement.

Even you don't specify * as missing, it will automatically read it as missing when you read it as numerical value. You will get an error message every time it happens. You could turn off the error message using options.

option error = 0;
data tst;
input var @@;
datalines;
1 43 6 23
2 31 3 *
3 * 3 7
;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top