DATA Step, Macro, Functions and more

read SAS data

Accepted Solution Solved
Reply
Contributor
Posts: 31
Accepted Solution

read SAS data

Given the SAS data set SASDATA TWO:


SASDATA TWO
XY
----
52
31
56
The following SAS program is submitted:
data sasuser.one two sasdata.three;
set sasdata two;
if x = 5 then output sasuser.one;
else output sasdata two;
run;
What is the result?

 

Not sure why the answer is 

A. data set SASUSER.ONE has 5 observations
data set SASUSER.TWO has 5 observations
data set WORK.OTHER has 3 observations

 

Thanks!


Accepted Solutions
Solution
‎10-05-2017 03:43 AM
Super User
Posts: 13,084

Re: read SAS data

AS written this line:

set sasdata two;

indicates that you are combining two different data sets Sasdata AND two, which by default would both be in the WORK library.

 

Your code does not actually show a reference to SASUSER.TWO or Other.

The periods in the data set names are crucial to accurate code as the . separates the library name, the bit before the . which is a storage location and the actual dataset name, the bit after the period.

 

View solution in original post


All Replies
Super User
Posts: 9,611

Re: read SAS data

Your question is not coherent. There is no dataset "other" mentioned in the datastep at all.

 

STRONG HINT:

run examples yourself to make sure that you present working code here, this is more or less a bad joke.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Solution
‎10-05-2017 03:43 AM
Super User
Posts: 13,084

Re: read SAS data

AS written this line:

set sasdata two;

indicates that you are combining two different data sets Sasdata AND two, which by default would both be in the WORK library.

 

Your code does not actually show a reference to SASUSER.TWO or Other.

The periods in the data set names are crucial to accurate code as the . separates the library name, the bit before the . which is a storage location and the actual dataset name, the bit after the period.

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 163 views
  • 1 like
  • 3 in conversation