Hi,
My question is the code like,
data work.test;
title='A TALE OF TWO CITIES, CHARLES J. DICKENS'
WORD=SCAN(title,3,' ,');
run;
What is the value of word?
A. T
B. OF
C.DICKENS
D. ''MISSING CHARACTER VALUE
I have run this code in sas like,
data work1;
input title $ 1-39;
datalines;
A TALE OF TWO CITIES, CHARLES J. DICKENS
run;
data work1;
WORD=SCAN(title,3,' ,');
run;
And i got log message like,
So,
What will be the answer comes? As my logic answer sholde be missing character value!
You didn't include a set statement in your second datastep. e.g.
data work1; input title $ 1-39; datalines; A TALE OF TWO CITIES, CHARLES J. DICKENS run; data work1; set work1; WORD=SCAN(title,3,' ,'); run;
Art, CEO, AnalystFinder.com
You didn't include a set statement in your second datastep. e.g.
data work1; input title $ 1-39; datalines; A TALE OF TWO CITIES, CHARLES J. DICKENS run; data work1; set work1; WORD=SCAN(title,3,' ,'); run;
Art, CEO, AnalystFinder.com
If the "test" code doesn't include any external file references I would suggest that you start first by running the code as provided in the test.
For the question code as posted all of the answers are wrong unless you consider an empty dataset as "missing character value" as the code will not run at all. You are missng a ; at the end of line two.
data work1;
input title $ 1-55;
datalines;
A TALE OF TWO CITIES, CHARLES J. DICKENS
run;
data work1;
set work1;
WORD=SCAN(title,3,' ,');
run;
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: