BookmarkSubscribeRSS Feed
GN0001
Barite | Level 11

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

 

 

Blue Blue
3 REPLIES 3
ballardw
Super User

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.

Tom
Super User Tom
Super User

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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 920 views
  • 1 like
  • 4 in conversation