These periodic technical tips appeared in the SAS Communications quarterly publication from the SAS Institute.
This table appeared in the 3Q 1997 edition of SAS Communications. It has been edited down to options applicable to the SAS installation on Athena.
|Reporting Option||Typical Uses||Benefits|
|Data Step||Method by which a reporting program can be created using the SAS Language.||Creating highly customized reports that will not require future modification.||Can control the placement and format of every item in a report.|
|PROC PRINT||Prepackaged procedure included in base SAS software that can be used to produce basic reports.||Producing simple detail reports. Gropuing observations and calculating statistics such as sums, means, and percentages. Producing data in summary form for further processing.||Easy, quick way to produce simple reports. Can incorporate features like titles, footnotes, formats, and column sums.|
|PROC TABULATE||Prepackaged procedure included in base SAS software that can be used to produce tabular reports.||Organizing data into tables, requesting statistics, and enhancing output.||Users can construct tables of descriptive statistics, analysis variables, and keywords for statistics. Tables can have up to three dimensions: column; row and column; or page, row and column.|
|PROC REPORT||Ad hoc report generator included with base SAS software. Combines features from the PRINT, MEANS, and TABULATE procedures along with elements of the DATA step to provide a powerful report writing tool.||Building batch reports to be run over and over and distributed to a wide audience. Can also be used to build reports interactively through pull-down menus.||Using the interactive mode, users don't need to know any SAS syntax to produce reports. Produces multipanel reports, customized breaks with descriptive text, descriptive statistics calculated percentages, and calculated variables.|
|SAS/ASSIST Software||The Report Writing Menu of SAS/ASSIST software provides a task level approach to creating reports.||Creating various types of reports including Listings, Tables, Frequencies, Plots, and Graphs, as well as designing reports from scratch.||Generates the appropriate SAS syntax as the user selects from the various menu items.|
Question: How can a duplicate copy of a data set be created within the same library without copying the data set to an intermediate location, renaming it, and copying it back?
Answer: The most efficient way to do this is to use the APPEND procedure. Also, unlike the DATA step, indexes are copied as well. If the data set supplied on the BASE= option does not exist, then it's created with the contents of the data set supplied with the DATA= option. Here is an example of creating a duplicate data set with a different name in the same library using PROC APPEND.
proc append base=sasuser.new data=sasuser.class; run; NOTE: Appending SASUSER.CLASS to SASUSER.NEW. NOTE: BASE data set does not exist. DATA file is being copied to BASE file. NOTE: The data set SASUSER.NEW has 19 observations and 5 variables. real time 1.34 seconds cpu time 0.11 seconds
Have you ever found yourself with a SAS data step which runs, but not quite as you want it to? The SAS Data Step debugger can help you find logic errors in your program by allowing you to step through your code, examine data, and even temporarily modify data values. The full text of this tip appears in the 1997 Q1 edition of SAS Communications.
To invoke the data step debugger, add the DEBUG option in the DATA statement. For example:
data temp/debug; do i=1 to 10; x=i*2; output; end; run;
When you submit this code you will see two new windows on your workstation screen, the DEBUGGER LOG window and the DEBUGGER SOURCE window. In the DEBUGGER LOG window you can type commands to examine variable values, set breakpoints, and change values. The results of these commands are shown as well. The DEBUGGER SOURCE window contains the source code for the DATA step you are debugging.
To end the debugger session, type QUIT on the command line in the DEBUGGER LOG window.
To set a breakpoint for examining data, use the break command. For example, instead of processing all the observations through the DATA step until you reach patient 3 (in the following example), set a breakpoint by typing
Break 3 when patient=3
in the DEBUGGER LOG window.
data hospital; input @1 patient @3 strtdt mmddyy8. @12 enddt mmddyy8.; stay=enddt-strtdt; cards; 1 02/01/96 02/05/96 2 05/15/96 05/30/96 3 05/20/96 05/01/96 4 07/14/96 07/16/96 5 09/04/96 09/15/96 ; run;
To examine the value of data variables, use the examine command. For example, once you stop at a break point, you can look at the current values of all the variables by typing
Examine strtdt mmddyy8. enddt mmdd778.
In the DEBUGGER LOG window.
allows you to examine all of the variables in the dataset.
[ SAS Home Page | Software Home Page | MIT Home Page ]