SAS P1 L2b Flashcards
What is an SAS comment?
SAS Comments:
text that is ignored during processing
but is written to log (when program runs)
Uses for SAS comments?
- document purpose of program
- explain segments
- mark SAS code as non-executing => commenting out code
Can help test program in stages:
comment out error free code
test only desired sections
What are the two types of comments?
2 types of comments:
Block comment
Comment Statement
How write a Block Comment?
begin?
end?
Block Comment:
begins with “/” (forward slash-asterisk)
ends with “/” (asterisk-forward slash)
Block comment: length? contain internal semicolons? nested? in column 1 or 2? why?
Block statement: any length CAN contain semicolons CANNOT be nested NO block comments in column 1 or 2 - some editors read as code -> request to end job
How write Comment Statement?
begin?
end?
Comment statement:
begins with “*” (asterisk)
followed by text of comment
ends with “;” (semicolon)
Comment Statement: length? contain internal semicolons? nested? in column 1 or 2?
Comment Statement: any length (?) CANNOT contain internal semicolons ?nesting CAN begin in columns 1 or 2
Syntax errors are?
3 common ones?
Syntax errors are program statements that don’t conform to rules of SAS
Common:
misspelled key words
missing semicolon
invalid options
How does editor indicate potential error?
Editor uses red to indicate potential errors
If data step has error, other steps following will also highlight since only work when in data step
When are syntax errors found?
Syntax errors are found during compilation, before program is executed
What does editor do if finds error? (3)
Editor will write: - error or warning - location - explanation Editor can also try to fix things - will show up in log
What if error statement actually looks ok?
Error is underlined - if that statement looks ok, probably missing semicolon before
What happens if unbalanced quotation marks?
Unbalance quotation marks:
Quotation mark counter keeps track
If detects uneven amount, won’t execute properly
Can use single? Double? quotation marks?
Both single and double quotes can be used, but not as pair to each other
Unbalanced quotation mark statement: appearance?
SAS will misread that statement and any following statements => will be colored purple = quoted string