I wrote code that I ran one time to get a database in SAS. Instead of delete this code, I tried block commenting it out. It appears that when I do this, it also comments out the following line of code after the block comments unless I add a semicolon at the end of the block comment.
Why does this happen?
This is the code that is making my next line be a comment without the semicolon in the last line.
/*/*/*/*/*%LET PriorMo = %SYSFUNC(PUTN(%EVAL(&MO -1),z2.));*/*/*/*/*/
/*/*/*/*/*%PUT &=PriorMo;*/*/*/*/*/
/*/*/*/*/*%LET YrPriorMo = &Yr&PriorMo;*/*/*/*/*/
/*/*/*/*/*%PUT &=YrPriorMo;*/*/*/*/*/
/*/*/*/*/*%SYMDEL PriorMo;*/*/*/*/*/
/*/*/*/*/*%LET strDbFilePathPrior = %SYSFUNC(CATX(\*/*/*/*/*/
/*/*/*/*/* ,\\blcfs04\#BLCFS04\HLTHFIN\ONGOING\LTC\Valuation*/*/*/*/*/
/*/*/*/*/* ,&Yr*/*/*/*/*/
/*/*/*/*/* ,&YrPriorMo*/*/*/*/*/
/*/*/*/*/* ,RGA*/*/*/*/*/
/*/*/*/*/* ,People History.accdb)*/*/*/*/*/
/*/*/*/*/* );*/*/*/*/*/
/*/*/*/*/*%PUT &=strDbFilePathPrior;*/*/*/*/*/
/*/*/*/*/*%MsOfficeImport(&strDbFilePathPrior*/*/*/*/*/
/*/*/*/*/* ,Cum Info*/*/*/*/*/
/*/*/*/*/* ,SaDAPHlt.VMF_Cumulative_Info*/*/*/*/*/
/*/*/*/*/* ,strFileType = ACCESS*/*/*/*/*/
/*/*/*/*/* ,strSasGrpNm=ActProdMgmtHealth*/*/*/*/*/
/*/*/*/*/* );*/*/*/*/*/
/*/*/*/*/*%SYMDEL strDbFilePathPrior YrPriorMo;*/*/*/*/*/;
HINT: Do not use multiple /*/*/* */*/*/ to comment code. The first /* starts a sequence but nested * and /* start confusing the processor.
Depending on exact code likely one or more of the /* get treated as the start of a * ; type comment. So the first statement following is treated as part of one of those comments, or require the ending ; as you mention.
Generally for blocks I use
/*
<all the code >
*/
to avoid that specific issue.
HINT: Do not use multiple /*/*/* */*/*/ to comment code. The first /* starts a sequence but nested * and /* start confusing the processor.
Depending on exact code likely one or more of the /* get treated as the start of a * ; type comment. So the first statement following is treated as part of one of those comments, or require the ending ; as you mention.
Generally for blocks I use
/*
<all the code >
*/
to avoid that specific issue.
How and Why did you create that wonderful display of gibberish? From the subject line I suspect that you have mis-used some editor feature. Remember that editors don't really know what they are editing. They are just following rules someone gave them.
Inserting a bunch of random /* and */ characters into your program is not a good idea.
Note that /* ... */ comments (block comments) do NOT nest. So this line
/*/*/*/*/*%LET PriorMo = %SYSFUNC(PUTN(%EVAL(&MO -1),z2.));*/*/*/*/*/
Is this block comment
/*/*/*/*/*%LET PriorMo = %SYSFUNC(PUTN(%EVAL(&MO -1),z2.));*/
Followed by the beginning of a statement comment ( * .... ; )
*/*/*/*/
So now SAS is on the hunt for a semi-colon to end that comment that you started on the first line.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.