Help using Base SAS procedures

What is the difference between First last statement and Summary statement

Reply
New Contributor
Posts: 2

What is the difference between First last statement and Summary statement

I am trying to summarise a data and was wondering if both "First Last" statement and Proc Summary would give the same result.

Is there any preference to either in certain special circumstances?

Thanks.

Akshay

Super User
Posts: 10,549

Re: What is the difference between First last statement and Summary statement

It MIGHT give the same result depending on how you code each.

The first/last process is usually when you need to do something special involving the variable(s) involved. Such as select a record, reset a counter, calculate a number of things that may not involve other values of the by variables, or possible create additional records.

If there are many values that need to be kept with those records Summary may not be a good choice as it wants everything on either a Class, Var or ID statements and one or more of those may not be appropriate to get keep those other variables.

Summary and Means are designed to provide summaries not individual records.

New Contributor
Posts: 2

Re: What is the difference between First last statement and Summary statement

Can it make a difference what procedure we use if there are blanks (dots) in the number field?

Super User
Posts: 10,549

Re: What is the difference between First last statement and Summary statement

At this point examples of data and desired output might be needed if you are trying to solve a specific problem. Proc summary or means will not include any value in a summary statistic for missing except the NMISS. With first. and last. processing you could conditionally do something with a missing value.

Ask a Question
Discussion stats
  • 3 replies
  • 331 views
  • 3 likes
  • 2 in conversation