BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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;
&&condition&i;
run;
%end;
%mend;
%example;

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?
2 REPLIES 2
Flip
Fluorite | Level 6
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.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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