SAS tips

SAS tips - EXST7005 Geaghan SAS Programming Basic...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
EXST7005 SAS Programming Geaghan Basic instructions Page 1 SAS Statements: All SAS statements end with a semicolon, ";". A statement may occur on one line, or run across several lines. Several statements can also be placed on the same line, as long as each statement ends with a semicolon. Statements need not start in the first column, so some lines can be intended for easier reading. But, all statements must end in a semicolon. The Comment statement : Any SAS statement that starts with an asterisk will be a comment statement. Comment statements do not result in any output. They are useful to label your SAS LOG in order to determine which program was run and on what data, and to provide explanations of programming steps for yourself and others. Comments may be placed anywhere in your SAS program. The following lines are statements that you might include at the start of your program. **EXST7015 EXAMPLE 1******************************************; *** Simple linear regression example run in SAS (1/1/1960) ***; *** James P. Geaghan ***; **************************************************************; A second type of comment is not a SAS statement. This type of comment employs special brackets (/* and */), and is created by surrounding any section of the program with /* in the front and */ after the end. Anything included within these brackets will not be executed. As a result, the brackets can not only be used to add comments anywhere in the program, but also to deactivate a part of a program. For example, the statements PROC SORT DATA=ONE; BY A B C; RUN; PROC PRINT DATA=ONE; VAR A B C D E F; RUN; can be "turned off" by adding the brackets. /* PROC SORT DATA=ONE; BY A B C; RUN; PROC PRINT DATA=ONE; VAR A B C D E F; RUN; */ This can be useful to temporarily deactivate programming segments without actually deleting the statements. Note that these two types of comments can be used anywhere in the program sections of SAS, but not within in the data listing if the data is included in the program. Options : The options statement in SAS can modify the size of your output. For example, when SAS is printed directly to the printer a page size of 51 lines (PS=51) should fit on one page. A page size of 60 might fill a page and then print a few lines on a second page (if the printer is set for fewer than 60 lines). Do not request a page size larger than the printer will accommodate unless you plan to save SAS output to a file then reformat the output in a word processor. Other options include line size (LS=78 will fit nicely on most printed pages), nocenter, nodate and nonumber (to suppress page numbering) or PAGENO=1 to insure that the page numbering starts at 1 when the program is rerun. OPTIONS PS=51 LS=78 NOCENTER NODATE NONUMBER;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/29/2011 for the course EXST 7005 taught by Professor Geaghan,j during the Fall '08 term at LSU.

Page1 / 8

SAS tips - EXST7005 Geaghan SAS Programming Basic...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online