BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mk123451243
Fluorite | Level 6
data outset;
   set inset (obs=10);
   where X=Y;

Does this code logic mean:

 

Select the first 10 observations from inset and select WHERE X=Y from those 10.

 

OR

 

Select observations from inset and apply WHERE X=Y until 10 observations have been selected.

 

I assume the former but there is an ambiguous question/solution in the Base Programming 2 course that is throwing me off:

 

3. Read only the first 10 observations satisfying the WHERE statement.

 

set orion.order_fact (obs=10);
   where year(Order_Date)=2009;
1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

This: Select observations from inset and apply WHERE X=Y until 10 observations have been selected.

 

If you have access to SAS, it is a lot faster to test yourself than to ask here, and a much better way to learn as well, by doing.

View solution in original post

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

This: Select observations from inset and apply WHERE X=Y until 10 observations have been selected.

 

If you have access to SAS, it is a lot faster to test yourself than to ask here, and a much better way to learn as well, by doing.

PGStats
Opal | Level 21

Compare test1 with test2

 

data test1;
set sashelp.class(obs=1);
where name = "John";
run;

proc print data=test1; run;

data test2;
set sashelp.class(obs=1);
run;

proc print data=test2; run;

If the WHERE condition was applied after the observation count, test1 would be empty.

 

PG

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