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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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