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'?
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;
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;
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.
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →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.