BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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
Cynthia_sas
Diamond | Level 26
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]

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1098 views
  • 0 likes
  • 3 in conversation