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.
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!
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.