The following SAS program is submitted:
libname sasdata 'SAS-data-library';
data test;
set sasdata.chemists;
if jobcode = 'Chem2' then description = 'Senior Chemist';
else description = 'Unknown';
run;
data test;
set sasdata.chemists;
if jobcode = 'Chem2' then description = 'Senior Chemist';
else description = 'Unknown';
run;
A value for the variable JOBCODE is listed below:
JOBCODE
chem2
JOBCODE
chem2
Which one of the following values does the variable DESCRIPTION contain?
A. Chem2
B. Unknown
C. Senior Chemist
D. ' ' (missing character value)
3 comments:
Answer: B
The dataset has ‘chem2’ and the if statement is looking for ‘Chem2’…
Remember the SAS variables are not case-sensitive but the SAS DATA is…
libname sasdata 'SAS-data-library';
That line is a bit misleading since 'SAS-data-library' isn't a valid name for a SAS data library...
To get a clear understand, try this code!! Senior Chemist will only occur with chem3
data chemists;
infile datalines;
input jobcode $;
datalines;
chem3
Chem3
CHEM3
cHEm3
;
data test;
set chemists;
if jobcode = 'chem3'
then description = 'Senior Chemist';
else description = 'Unknown';
run;
Post a Comment