Help using Base SAS procedures

SAS code for identifying null records in a datasets

Reply
Occasional Contributor
Posts: 12

SAS code for identifying null records in a datasets

Hi,
I have a dataset.If i have null value in the dataset then i need to output it .
The problem is it shuld be done without knowing the coloumn names or to put in simple terms it shuld be generic so that i can use it for any dataset i want.

pls provide inputs .

Thanks & Regards
KAKA Message was edited by: kaka
Respected Advisor
Posts: 3,799

Re: SAS code for identifying null records in a datasets

Posted in reply to karthikeyan_S
You should be able to find several references to this problem in the archive.

If you have 9.2 look at CMISS and NMISS functions.

If you don't have 9.2 look at coalesceC and NMISS

Also the "SAS Variable List" specifically _NUMERIC_ and _CHARACTER_
Occasional Contributor
Posts: 12

Re: SAS code for identifying null records in a datasets

Posted in reply to data_null__
Sir Thanks for ur reply .
The NMISS just returns the count and CMISS is not ter in 9.1.3.
The coalesceC function is used to list hte first non missing value
I need to ouput that record to a file if i find a null in any of the coloumns.
could u pls help me out .
SAS Super FREQ
Posts: 8,862

Re: SAS code for identifying null records in a datasets

Posted in reply to karthikeyan_S
Hi:
This previous forum posting contains a link to the SAS documentation which talks about the difference between SAS missing values and NULL values, such as used by an RDBMS:
http://support.sas.com/forums/thread.jspa?messageID=24688恰

In order for anyone to help you with more than hints (such as NMISS or MISSING), you need to provide more information, such as:
1) What operating system are you using (Windows, Unix, mainframe, etc)

2) What version of SAS are you using (SAS 8.2, 9.1.3, 9.2)

3) What type of data are you accessing (data is in RDBMS (which one), data is in "flat" file and being read into SAS, data is in SAS datasets, data is in CSV or other format file)

4) HOW are you planning to read your data into SAS (PROC IMPORT, SET statement, DATA step program with INFILE/INPUT)

5) What type of data are you reading?? All character, all numeric, mix of character and numeric (and a brief description of the data would be useful) And, do you want to test for SAS MISSING values in each variable value or do you want to test for NULL values, as described in the documentation link above for RDBMS tables??

6) What is the logic of the process that should take place?
For example -- need to test each variable and when the first missing or null value is found, stop testing and immediately output the whole observation; or need to test each variable and when the first missing or null value is found, keep testing all the variables and then output the observation if there were ANY missing values in ANY observation.

7) What is your desired output?? A "flat file", a CSV file, a report, a SAS dataset???

cynthia
Ask a Question
Discussion stats
  • 3 replies
  • 153 views
  • 0 likes
  • 3 in conversation