Presentation is loading. Please wait.

Presentation is loading. Please wait.

SAS in Data Cleaning.

Similar presentations


Presentation on theme: "SAS in Data Cleaning."— Presentation transcript:

1 SAS in Data Cleaning

2 Changing Text Words TRANWRD(source,target,replacement)
replaces or removes all occurrences of a word in a character string Will change all occurrences of the target character string with the new one. Supplier= Tranwrd(supplier, "Incorporated", "Inc.");

3 Extract a specific ‘word’ from a string.
SCAN(argument,n<,delimiters>)returns a given word from a character expression Extracts the n-th word from the string. The delimiters can define the word. Default delimiters are blank and special characters. If scan(Reverse(Trim(supplier)),1, " ") = "& " then do; …

4 Extracting specific characters by position
var=SUBSTR(argument,position<,n>) extracts a substring from an argument. (var is any valid SAS variable name.) Position starts with 1. n is number of characters to extract Department= Substr(pcode,1,2);

5 If … Then IF condition THEN action; Or IF condition THEN DO;
Statements END;

6 Multiple output data sets
DATA One Two; SET Input; OUTPUT One; OUTPUT Two;


Download ppt "SAS in Data Cleaning."

Similar presentations


Ads by Google