BookmarkSubscribeRSS Feed
deleted_user
Not applicable
i have data table like this with brand_cd field
Brand_cd
12
13
14

i want output like this(Different tables)

Brand_cd1(one table)
12
Brand_cd2(second table)
13
Brand_cd3(third table)
14
1 REPLY 1
Anitha_SAS
SAS Employee
Example:

/* sample data set with 3 observations */
data a;
Brand_cd=12;output;
Brand_cd=13;output;
Brand_cd=14;output;
run;

/*macro to output line into new table*/
%macro test(currTable,index);
data &currTable;
set a(firstobs=&index obs=&index);
output;
run;
%mend test;


/* invoke the macro */
%test(Brand_cd1,1);
%test(Brand_cd2,2);
%test(Brand_cd3,3);

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore 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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1053 views
  • 0 likes
  • 2 in conversation