DATA Step, Macro, Functions and more

A single semicolon inside a data step.

Posts: 0

A single semicolon inside a data step.

I have a number of conditions declared as macrovariables:

%let cond1=if x=10;
%let cond2=if x=20;
%let cond9=if x=90;

and an "empty" condition: %let cond10=;

I am creating 10 tables by looping in a macro:

%macro example;
%do i=1 %to 10;
data work&i;
set worktotal;

When i=1-9 I get the wanted conditions and when i=10 I get a single semicolon.

When i=10 work10 should be set to worktotal. This seems to work.

But I want to know if, in general, it's OK to place a single semicolon on a line in a data step where nothing should happen?
Super Contributor
Posts: 359

Re: A single semicolon inside a data step.

Extra semicolons are fine. I have known several programmers that like to use them on blank lines to hold space. I have never figured out why they do this, but it does not hurt.
Super Contributor
Super Contributor
Posts: 3,174

Re: A single semicolon inside a data step.

With SAS version 6, there was a SAS code compiler issue when using SAS macros mixed with SAS old-style (SAS 79 style) macro statements within nested (multiple) %INCLUDE references. At times a SAS DATA statement would need to be ended with 4 or 5 semi-colons to ensure the compiler flushed well during compile processing.

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation