Hello!
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
data OJOSData;
obsnum=6;
set grades point=obsnum;
output;
stop;
run;
but this doesn't?
data OJOSData;
set grades point=6;
output;
stop;
run;
I was just wondering what the underlying reason is.
Many thanks
Oliver
PS the SAS University software is a godsend for testing things like this that puzzle me
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.
data want;
set have (firstobs = 6 obs = 6);
run;
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...
data OJOSData;
fobs=7;
set grades (firstobs=fobs);
run;
Thanks SASKiwi, something for me to think about!
That's right - refer to the documentation for the correct use of each option.
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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.