Hello team,
Would you please let me know what these two scan function do with space as a delimiter?
FirstName = Scan(MemberName, 1, " ");
LastName = Scan(MemberLast, 2, " ");
Regards,
Blue
Maxim 1: Read the Documentation: SCAN Function
and Maxim 4: Do a Test Run. Feed some strings to these function calls and see what happens.
Without example values for Membername or Memberlast which should I guess.
"result" can be interesting depending on other characters in the variable and which position.
Give me actual values I can tell you. But I'm not going to guess because there are way too many possible results from missing to equal to the variable depending on the actual values that it isn't worth trying to list all of them.
Plus depending on the character encoding you might actually need Kscan.
The two assignment statements are both asking SAS to parse the value of the variable pass to them into "words" based on considering blanks as the delimiter between the words.
The first one is taking the first word it finds.
The second one is taking the second word it finds.
Also the two assignment statements are taking the words from two DIFFERENT variables.
The first one is reading from the variable MEMBERNAME and the second one is reading from the variable MEMBERLAST.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.