BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
poo
Calcite | Level 5 poo
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
poo
Calcite | Level 5 poo
Calcite | Level 5

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

View solution in original post

5 REPLIES 5
Tom
Super User Tom
Super User

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

poo
Calcite | Level 5 poo
Calcite | Level 5

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

poo
Calcite | Level 5 poo
Calcite | Level 5

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?

poo
Calcite | Level 5 poo
Calcite | Level 5


Thanks for the Post Manish!

poo
Calcite | Level 5 poo
Calcite | Level 5

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.

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 3846 views
  • 4 likes
  • 2 in conversation