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;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.