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);

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 842 views
  • 0 likes
  • 2 in conversation