Hi,
Can someone explain what does this mean?
FIRST_REGNUMBER=FIRST.REGNUMBER ;
LAST_REGNUMBER=LAST.REGNUMBER;I had tried to read the explanation from different source but I am still confuse.
Thank you.
A temporary flag is added to the data, called first.<variable> and last.<variable> for each variable in the by group, this flag can then be used to determine if the record is the first or last occurence within the by group.
There are many guidance documents out there about this:
https://onlinecourses.science.psu.edu/stat481/node/9
For example.
Also, as a tip, do not code all in uppercase.
It gives you the first/last row of a group. A quick example:
data aa1;
set sashelp.cars;
by make;
if first.make then
output;
else if last.make then
output;
run;
Gives you a table with only the first and last row per make in the table
A temporary flag is added to the data, called first.<variable> and last.<variable> for each variable in the by group, this flag can then be used to determine if the record is the first or last occurence within the by group.
There are many guidance documents out there about this:
https://onlinecourses.science.psu.edu/stat481/node/9
For example.
Also, as a tip, do not code all in uppercase.
Since the automatic first. and last. variables (which are created when a by statement is present in the data step) are not included in any output data, these assignments are a technique to make the values visible in the output dataset.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.