BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Phil_NZ
Barite | Level 11

Hi all SAS Users,

 

Today I answer wrongly the question below regarding scan function

Phil_NZ_0-1617522693486.png

To me I still think b should be the correct answer. Because scan function accept the negative number to read from the right. I still do not think that the answer c is correct, because it is redundant, because',' is a default delimiter in SCAN function so we do not need to list it out .

 

I may fall in a fallacy but I cannot convince me myself the correct answer is c instead of b.

 

Warmest regards and thanks.

Thank you for your help, have a fabulous and productive day! I am a novice today, but someday when I accumulate enough knowledge, I can help others in my capacity.
1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @Phil_NZ,

 

The issue with answer b is that it uses all default delimiters, i.e., including the blank, which results in Country='Zealand' for observation no. 3. (Maxim 4: Try it.)

 

However, answer c is not ideal either: Without using the 'R' modifier it leaves a leading blank in variable Country because a blank follows the comma (i.e., the only word delimiter used) in CityCountry. For HTML output (as shown in the screenshot) this doesn't matter, but, e.g., a WHERE condition Country='India' would fail.

View solution in original post

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hi @Phil_NZ,

 

The issue with answer b is that it uses all default delimiters, i.e., including the blank, which results in Country='Zealand' for observation no. 3. (Maxim 4: Try it.)

 

However, answer c is not ideal either: Without using the 'R' modifier it leaves a leading blank in variable Country because a blank follows the comma (i.e., the only word delimiter used) in CityCountry. For HTML output (as shown in the screenshot) this doesn't matter, but, e.g., a WHERE condition Country='India' would fail.

Phil_NZ
Barite | Level 11

Thank you @FreelanceReinh 

I see the case 'Zealand' ,it makes total sense to me now.

 

Warm regards.

Thank you for your help, have a fabulous and productive day! I am a novice today, but someday when I accumulate enough knowledge, I can help others in my capacity.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1260 views
  • 1 like
  • 2 in conversation