Help using Base SAS procedures

comments in SAS

Reply
N/A
Posts: 0

comments in SAS

Hi,

I am using the code as below and want to write commenets to make the code understanding , kindly correct me if I am wrong soemwhere :-


ods rtf file='Corr.rtf'/*initialise and send results to the RTF file Corr.rtf until the file is closed*/;
proc corr data = review1 outest = Corr/*create a temporary dataset Corr */;
VAR Z X Y/*determine the correlation between each variable*/;
RUN;
ods rtf close /* close the RTF file Corr*/;

Kindest Regards
Mark
Super Contributor
Super Contributor
Posts: 3,174

Re: comments in SAS

The comments are syntactically correct.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

comment statement site:sas.com Message was edited by: sbb
SAS Super FREQ
Posts: 8,742

Re: comments in SAS

Hi:
As Scott said, your comments are syntactically correct. However, if you ever want to "comment out" an entire step or block of code, you will not be able to put /* and */ around your PROC CORR step because you are already using that syntax.

You might want to consider adding a bit of white space and/or not mixing commas inside your complete statements (put the comment outside the semi-colon). The first example could have the entire step commented out because you use *; type of comments. The second example is a variation on your original code,

Either of these models seems easier to read to me. Indenting code and using white space seem to increase readability.

cynthia

[pre]

Example 1
*******************************************************************************;
* initialise and send results to the RTF file Corr.rtf until the file is closed;
* create a temporary dataset Corr;
* determine the correlation between each variable;
* close the RTF file Corr;
*******************************************************************************;

ods rtf file='Corr.rtf';

proc corr data = review1 outest = Corr;
VAR Z X Y;
RUN;

ods rtf close;


Example 2

ods rtf file='Corr.rtf'; /*initialise and send results to the RTF file Corr.rtf until the file is closed*/

proc corr data = review1
outest = Corr; /*create a temporary dataset Corr */
VAR Z X Y; /*determine the correlation between each variable*/
RUN;

ods rtf close; /* close the RTF file Corr*/



[/pre]
Ask a Question
Discussion stats
  • 2 replies
  • 112 views
  • 0 likes
  • 3 in conversation