Sunday, March 27, 2016

NMISS

SAS Function to handle MISSING data -  NMISS

Syntax : NMISS(argument,...argument-n)


Description:  The NMISS() function returns the number of missing values in the specified list of numeric variables. 

Note:The NMISS() function converts any character values to numeric before assessing if the argument value is missing.

MISSING function vs NMISS function NMISS works with multiple numeric values, whereas MISSING works with only one value that can be either numeric or character

Examplecount the number of the variables X, Y, and Z which have missing values:
 Count=nmiss(x,y,z)
 Count=nmiss(of x y z)


Code:



Result:




Got Questions? Please put them in comment box....
Cheers

Wednesday, March 23, 2016

Reading Missing Values In Flat Files

Reading Missing Values In Flat Files

Description: Reading Missing Values at the End of a Record as in mohit.txt  using missover  and
Reading Missing Values at the Beginning or Middle of a Record as in rohit .txt using dsd .


NOTE : By default delimiter is space " " so no need of giving it with missover but on the other hand with dsd by default delimiter is comma "," so that we  have to give dlm = " " if it is space delimited file

Flat Files
    
mohit.txt
 
rohit.txt
EXAMPLE


OUTPUT

Missover







Dsd






And the LOG Window



Got Questions ? Pls put them in Comment Box........



Tuesday, March 22, 2016

The Missing Function in SAS

The Missing Function in SAS

Syntax for Missing Function :   MISSING(numeric expression|character expression)

DescriptionThe MISSING function checks whether the argument/expression  has a missing value, and returns a numeric result. If the argument/expression does not contain a missing value, SAS returns a value of 0. If the argument/expression  contains a missing value, SAS returns a value of 1. 

Note: The MISSING function checks whether the argument has a missing value but does not change the value of the argument.

Example




Output


And The Log window


Got Questions? Please put them on comment box....

Cheers,

Wednesday, March 2, 2016

SAS Statements: Libname #1.1 Assigning and Deassigning Libraries

* Assigning user defined Library;

Libname am "C:\Users\amit\Desktop";


****************************;

* Deassigning user defined Library;

Libname am clear;