06-24-2015 09:44 PM
I had a quick look, but couldn't find any questions similar to this, so hopefully I'm not bringing up old questions.
What is the reason the the POINT= option only works when set to a set to equal a variable (eg the obsnum below), rather than just setting it to equal an integer?
eg why does this work
set grades point=obsnum;
but this doesn't?
set grades point=6;
I was just wondering what the underlying reason is.
PS the SAS University software is a godsend for testing things like this that puzzle me
06-24-2015 09:55 PM
There are already options for reading a specific observation or range of observations. FIRSTOBS= for the first record to be read and OBS= for the last record to be read.
POINT= is for identifying observations by formula/calculation.
set have (firstobs = 6 obs = 6);
06-25-2015 01:30 AM
Right! It's interesting isn't it how certain rules work in certain ways.
With POINT you HAVE to use a variable, but with firstobs you CANNOT use a variable. At least I can't make it work...
set grades (firstobs=fobs);
Thanks SASKiwi, something for me to think about!
06-30-2015 09:15 AM
obs= and firstobs= dataset options are designed to subset the data before it reaches the data step or a procedure. As they are data set options, they work almost in any circumstances. For example in a proc step. Obviously you don't have data step variables in a proc step. obs= and firstobs= can subset the observations very efficiently.
point= works only in a data step, it is an option of the set statement. It is designed to allow random/direct access to specific observations.
For example if you want to read the 10th, 20th and than again the 10th observation.