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

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!

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

2 REPLIES 2
Kurt_Bremser
Super User

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.

ballardw
Super User

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.

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 2155 views
  • 4 likes
  • 3 in conversation