Programming the statistical procedures from SAS

creating and combing serial tables with macro variables

Accepted Solution Solved
Reply
Regular Contributor
Posts: 163
Accepted Solution

creating and combing serial tables with macro variables

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


Accepted Solutions
Solution
‎07-04-2015 01:12 PM
Respected Advisor
Posts: 4,756

Re: creating and combing serial tables with macro variables

Replace

%let j=&var-1;

with

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


PG

PG

View solution in original post


All Replies
Solution
‎07-04-2015 01:12 PM
Respected Advisor
Posts: 4,756

Re: creating and combing serial tables with macro variables

Replace

%let j=&var-1;

with

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


PG

PG
Regular Contributor
Posts: 163

Re: creating and combing serial tables with macro variables

Thank you PGSats

best regards

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

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