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

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. 

 

               Screenshot 2023-07-16 at 19.31.42.png

 

             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.

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

I guess I see 4 statements, the title statement is not "in the proc print step" which ends at run;

--
Paige Miller

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

I guess I see 4 statements, the title statement is not "in the proc print step" which ends at run;

--
Paige Miller
Cynthia_sas
SAS Super FREQ

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):

Cynthia_sas_0-1689541802109.png

 

  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:

Cynthia_sas_1-1689542385691.png

  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

PaigeMiller
Diamond | Level 26

@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?

--
Paige Miller
Cynthia_sas
SAS Super FREQ

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:

Cynthia_sas_0-1689558861630.png

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

Nellysas
Fluorite | Level 6
Thank so much Cynthia,

All the information that you share with me is really interesting and help me to understand better.
When I did the activity I forgot what we read in the lesson about the end proc, I did not pay attention to the keyword “run”. And forgot too, about the global statements are not in the Data o Pront Steps. But for sure I will never forget.
Maybe it is not so important, but I am new on SAS programming, so for me is nice to discover my mistakes.

Best regards,
Nelly.

Nellysas
Fluorite | Level 6
Thanks so much for your answer, now I got it. Title is not a statement in the Proc print step, you are right.

SAS Innovate 2025: Register Now

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!

LIBNAME 101

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.

Discussion stats
  • 6 replies
  • 1972 views
  • 4 likes
  • 3 in conversation