DATA Step, Macro, Functions and more

scan function

New Contributor
Posts: 3

scan function

Data test;

title = ' A tale of two cities , charles J. dickens' ;

word = scan( title, 3 , ',');



what will be the value of the variable word in output data set , my answer is missing char. value but in mock test answer is ' of ' we have a comma after cities and in syntax i have mentioned that take ' , ' comma as delimiter  so in that case 3rd word should be missing . can u plz explain this question .

Respected Advisor
Posts: 2,833

Re: scan function

[ Edited ]

You are correct. (Of course this assumes you have not made a typing error, and the scan function really have ',' as the third argument and not ' ,' which has a space in it).


This is not something that needs to be posted in the SAS communities, as you can run the code yourself and see what the result is. This is a question you need to ask whomever created this test in the first place.

Paige Miller
Occasional Contributor
Posts: 13

Re: scan function

Hi Sanyam,


     Where are you taking those mock questions from? This is the second thread you start about those mock question pointing out that they appear to have wrong answers. Are you taking these from a recongnized source?



Super User
Posts: 23,332

Re: scan function

You get what you pay for. If you have to verify your course materials, its not really a good use of your time.

Ask a Question
Discussion stats
  • 3 replies
  • 4 in conversation