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

sas-innovate-2024.png

Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.

 

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

 

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
  • 1 reply
  • 554 views
  • 0 likes
  • 2 in conversation