The SAS can’t handle empty strings passed through the SUBSTR function along with calculating the length of the empty string, hence this NOTE. You will find some weird NOTE printed by SAS because of the length() and substr functions. PostCode=SUBSTR(address, length(address)-6, 7) Įxecute the above code and check out the logs. * Handle missing values while extracting from string */ Let’s see what happens to substr function if you pass the address variable as an input string and extract postal code. There won’t be any issue using substr function until you encounter missing values or empty input string.įor example in the addr data set below observe the 3rd row where address is missing for Kim Karlsen. Substr is also being used while creating data by reading datalines or raw input files. How to handle missing values while extracting from string * All string except the last two chars */Īll_except_last_two_chars = substr(var_str, 1, length(var_str)-1)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |