Could someone please explain me answer of this question? I am going for Base exam in few days.
The contents of the SAS data set named PERM.STUDENTS are listed below:
name age
Alfred 14
Alice13
Barbara 13
Carol 14
The following SAS program is submitted using the PERM.STUDENTS data set as
input:
Libnameperm 'SAS-date-library';
data students;
set perm.students;
file 'file-specification';
put name $15. @5 age 2.;
run
Which one of the following represents the values written to the output raw data file?
A. ----|----10---|----20---|----30
Alfred 14
Alice 13
Barbara 13
Carol 14
B. ----|----10---|----20---|----30
Alfr14
Alic13
Barb13a
Caro14
C. ----|----10---|----20---|----30
Alfr14ed
Alic13e
Barb13ara
Caro14l
D. ----|----10---|----20---|----30
Alfred 14
Alice 13
Barbara 13
Carol 14
Thanks
Poo
Tom Thanks for reply, I got the answer.
age variable has range of '2' so it is just replacing 5th and 6th place with it.
correct answer is B
Think about what the PUT statement means and how it will be processed by SAS. Then tell us which one you think is right and why. Also why are the other ones wrong?
put name $15. @5 age 2.;
Also it helps to post the results with a fixed space font like Courier .
A.
----|----10---|----20---|----30
Alfred 14
Alice 13
Barbara 13
Carol 14
B.
----|----10---|----20---|----30
Alfr14
Alic13
Barb13a
Caro14
C.
----|----10---|----20---|----30
Alfr14ed
Alic13e
Barb13ara
Caro14l
D.
----|----10---|----20---|----30
Alfred 14
Alice 13
Barbara 13
Carol 14
Tom Thanks for reply, I got the answer.
age variable has range of '2' so it is just replacing 5th and 6th place with it.
correct answer is B
I have few more question on Base SAS, Could someone help me out or Is there anyone who is going to take Base Exam soon who wants to discuss question with me. I can send them my email-id if they want to. I will appreciate the help.
1-The following SAS program is submitted:
data work.test;
Author = 'Agatha Christie';
First = substr(scan(author,1,' ,'),1,1);
run;
Which one of the following is the length of the variable FIRST in the output dataset?
A. 1
B. 6
C. 15
D. 200
For me out put of First = substr(scan(author,1,' ,'),1,1) will be A . Lenth of output(A) will be 1 but this is not true.
2- The following SAS program is submitted:
data work.accounting;
set work.dept1 work.dept2;
run;
A character variable named JOBCODE is contained in both the WORK.DEPT1
and WORK.DEPT2 SAS data sets. The variable JOBCODE has a length of 5 in the
WORK.DEPT1 data set and a length of 7 in the WORK.DEPT2 data set.
Which one of the following is the length of the variable JOBCODE in the output
data set?
A. 5
B. 7
C. 8
D. 12
here we are concatenating two data sets so length of jobcode in final data set would be 7. Is it correct?
Thanks for the Post Manish!
Question-
A PROC DATATSETS is used as follows(assumption: all libraries are and datasets
are existing):
proc datasets library=mylib details;
copy out=rloc;
select scoredata;
delete tension ;
run;
Which statement below explains the operations above most correctly?
a.
It lists all SAS data files with file size and date modified in ‘mylib’ library
and makes a copy of ‘scoredata’ file in ‘rloc’ library and deletes ‘tension’
dataset..
b. It lists all SAS data files with file size and date modified in ‘mylib’
library and deletes ‘tension’ file from ‘rloc’ library.
c. It lists all SAS data files with file size and date modified in ‘mylib’
library and makes a copy of ‘scoredata’ file in ‘rloc’ library and also copies
the ‘scoredata’ file in ‘rloc’ library.
d. It lists all sas data files with file size and date modified in ‘mylib’
library and makes a copy of ‘scoredata’ file in ‘rloc’ library.
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.