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

Hello, 

 

I would like to analyze the variables/results from one observation. Such that I want to look at all the responses to variables that individual/observation '32'. How would I code for that? Additionally how can I look at all the observations for example that chose 'yes' to a variable called 'smoker'? Can sas give me an output with all the observations that chose 'yes'?

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

To read exactly one particular observation, you can use the point= option:

data want;
xx = 32;
set sashelp.cars point=xx;
output;
stop;
run;

For subsetting to a special value, use a simple where condition:

data want;
set sashelp.cars;
where make = 'BMW';
run;

View solution in original post

4 REPLIES 4
Kurt_Bremser
Super User

To read exactly one particular observation, you can use the point= option:

data want;
xx = 32;
set sashelp.cars point=xx;
output;
stop;
run;

For subsetting to a special value, use a simple where condition:

data want;
set sashelp.cars;
where make = 'BMW';
run;
UGAstudent
Calcite | Level 5
Go DAWGS! 🙂
Astounding
PROC Star

If you are certain that observation 32 is the one you want, here is a method that works both with a DATA step and with SAS procedures:

 

data want;
   set have (firstobs=32 obs=32);
run;

proc print data=have (firstobs=32 obs=32);
run;

Subsetting based on a "yes" is easy, as @Kurt_Bremser has shown.  You need to know how to do that.

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand in the Innovate Hub.

Watch Now →
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 2466 views
  • 0 likes
  • 3 in conversation