Hello,
I just did the activity and I have a doubt in question number 2 :
2) How many statements are in the proc print step?
The correct answer is four, but I find 5.
the statement proc print
the statement var
the statement "where" like a assignment statement
the statement run
and the global statement title
Maybe I am wrong and I have confused "where" like a statement, I will thank an answer to clarify me.
Thanks so much,
best regards.
I guess I see 4 statements, the title statement is not "in the proc print step" which ends at run;
I guess I see 4 statements, the title statement is not "in the proc print step" which ends at run;
Hi:
Question 3 in that same activity is going to ask students about Global statements. That's where they can count the TITLE statement. The point of this activity is to get the students to identify global versus regular statements and to recognize step boundaries.
My take on your thought exercise, if the TITLE statement were inside the PROC PRINT, I would say that there are still 4 PROC PRINT statements and 1 global statement that has been placed INSIDE the PROC PRINT step. But, in the activity program, we want the students to start learning how to read the program -- how to identify the steps, how to identify step boundaries and global statements.
The lecture immediately before that activity is explaining SAS program structure and what a program "step" is. The lecture covers how a "step" is composed of statements and typically ends with a RUN or QUIT statement. The lecture explains that a SAS program can also contain global statements (like TITLE or FOOTNOTE or LIBNAME,etc) which do not end with a RUN or QUIT.
The program for the activity looks like this (I've added the color coding):
But why bother with the emphasis on global statements at all? What if the PROC PRINT statement was as you coded it, but there was not any TITLE statement before the PROC MEANS? A new SAS programmer might not expect these results from the changed program:
The TITLE statement is still a GLOBAL statement whether it is placed inside or outside of the PROC step where it is used. One of the reasons our programs always show the TITLE and FOOTNOTE statements placed immediately BEFORE the PROC statement in our starter programs is so students get into the habit of thinking first about the global statements, such as OPTIONS, LIBNAME and TITLE and FOOTNOTE, that their steps will need to have in effect before the step runs.
Cynthia
@Cynthia_sas wrote:
Question 3 in that same activity is going to ask students about Global statements. That's where they can count the TITLE statement. The point of this activity is to get the students to identify global versus regular statements and to recognize step boundaries.
Is not WHERE a global statement? It is not listed under the PROC PRINT documentation, so wouldn't that mean it is not a PROC PRINT statement? But really, this is splitting hairs to a degree that doesn't seem to be relevant to testing beginners about SAS.
Isn't the concept that the question is trying to get at that PROC PRINT ends with the run; statement?
Hi:
The WHERE statement is not a global statement. Here's the page for Global Statements: https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsglobal/n0e7kamd4b486zn10o4lcseg4qvd...
WHERE is a flexible statement, documented in the DATA step syntax, https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1xbr9r0s9veq0n137iftzxq4g7e.ht... but with the extra information that it can be used with any procedure that reads data:
In the context of the program for that activity, I would consider WHERE to be a statement that "belongs" to PROC PRINT syntax in that example, in a way that is different from the TITLE statement or other GLOBAL statements. The WHERE statement has to be used somewhere -- inside a DATA step or a PROC STEP. The WHERE statement can't be used in the same way that a TITLE, FOOTNOTE, OPTIONS or other global statement can be used.
But you're right, to a certain extent, this is splitting hairs. Yes, one of the goals was to have the student recognize that the RUN; ends the PROC PRINT and the PROC MEANS and the DATA step in this activity. But one of the other goals was to have them recognize that the TITLE statements are GLOBAL statements that do not need a RUN;
Cynthia
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Follow along as SAS technical trainer Dominique Weatherspoon expertly answers all your questions about SAS Libraries.
Find more tutorials on the SAS Users YouTube channel.