BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ammarhm
Lapis Lazuli | Level 10

Hi all

Can anyone please advice me how to correct this code, I am basically trying to create and combine serial tables

%macro repeat_comb(levels=);

%do var=1 %to &levels;

%let j=&var-1;

proc sql;

create table s&var as

select a.*,b.flag as L&var

from s&j as a

left join tableD as b

on a.class like b.L&var;

quit;

%end;

%mend;

%repeat_comb(levels=8)

The problem is in creating the second variable (j) and using it to refer to tables s&j which is returing error

Best regards

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Replace

%let j=&var-1;

with

%let j=%eval(&var-1);


PG

PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

Replace

%let j=&var-1;

with

%let j=%eval(&var-1);


PG

PG
ammarhm
Lapis Lazuli | Level 10

Thank you PGSats

best regards

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1273 views
  • 0 likes
  • 2 in conversation