BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
PrinceAde
Obsidian | Level 7

Hi everyone! Please I'm trying to figure out if the process of setting the accumulating variable in sum statement occurs at the compilation or execution phase.

The documentation reads, "the variable is automatically set to 0 before SAS reads the first observation. The variable's value is retained from one iteration to the next, as if it had appeared in a RETAIN statement." I think "before SAS reads the first observation" implies it occurred before the data step execution, i.e. at the compilation stage.

Now in the case of group processing where the accumulating variable is set to zero at the start of each BY group, this appears to be at the execution stage.

 

Thanks.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

During compilation, the memory space for variables is set up, and usually initialized with missing values. Under certain circumstances, other values are used (0 through a SUM statement, or the initial values declared in a RETAIN).

View solution in original post

7 REPLIES 7
LinusH
Tourmaline | Level 20

I don't think this will make any practical difference.

My two cents, compilation is the process to transform your text input to executable instructions.

Setting  up variables, assignments and such, for me that is part of the execution.

Data never sleeps
Kurt_Bremser
Super User

During compilation, the memory space for variables is set up, and usually initialized with missing values. Under certain circumstances, other values are used (0 through a SUM statement, or the initial values declared in a RETAIN).

PrinceAde
Obsidian | Level 7

This is very helpful. Thank you.

PrinceAde
Obsidian | Level 7

Thank you.

Astounding
PROC Star
All takes place during the compilation phase. There is no such thing as automatic changing a retained variable for a BY statement. You have to program that yourself, and it executes during the execution phase.
PrinceAde
Obsidian | Level 7

Okay Thank you.

Welcome to the Certification Community

 

This is a knowledge-sharing community for SAS Certified Professionals and anyone who wants to learn more about becoming SAS Certified. Ask questions and get answers fast. Share with others who are interested in certification and who are studying for certifications.To get the most from your community experience, use these getting-started resources:

Community Do's and Don'ts
How to add SAS syntax to your post
How to get fast, helpful answers

 

Why Get SAS Certified.jpg

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 3098 views
  • 1 like
  • 4 in conversation