Hi all SAS Users,
Today I answer wrongly the question below regarding scan function
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.
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.
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.
Thank you @FreelanceReinh
I see the case 'Zealand' ,it makes total sense to me now.
Warm regards.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—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.