BookmarkSubscribeRSS Feed
TarunKumar
Pyrite | Level 9

Hi

I have huge data of mulitiple location, I want to create branch code  wise data set with same name as branch code  and excel file using marco.Below attcahed is sample data.

Branch_codecust_nameRevenue
100a25000
100s35000
100d45000
200f6000
200f5000
100b6000
300a6000
200d5000
200f6000
300g6000
6 REPLIES 6
manojinpec
Obsidian | Level 7

 

%macro abc;

data test;

branch_code=100;

cust_name='a';

revenue=25000;

output;

branch_code=200;

cust_name='b';

revenue=2500;

output;

branch_code=200;

cust_name='c';

revenue=25000;

output;

branch_code=300;

cust_name='d';

revenue=5000;

output;

run;

proc sql;

select count(distinct(branch_code)) into :n from test;quit;

%let n= %trim(&n);

proc sql;

select distinct(branch_code) into :branch_code1-:branch_code&n from test;

quit;

%do i=1 %to &n;

data branch_&&branch_code&i. ;

set test;

if branch_code="&&branch_code&i." ;

run;

%end;

%mend;

%abc

Since dataset name cannot start with number i have prefixed with brnach

TarunKumar
Pyrite | Level 9

Thanx Manoj

it worked perfectly. request you t pls explain the same code

manojinpec
Obsidian | Level 7

I see you are in gurgaon. You can reach me @9560771148 and i would be happy to explain further.

I have created a macro variable abc which uses the dataset test having the information of brnach_code etc.

Now i have created a macro variable n which contains total number of distinct brnach code.

Now the do loop runs the code for n number of times for each brnanch code.


BrahmanandaRao
Lapis Lazuli | Level 10
Hi manoj
how to send email for branch wise managers using proc report procedure
Kurt_Bremser
Super User

@BrahmanandaRao wrote:
Hi manoj
how to send email for branch wise managers using proc report procedure

You posted your question as a reply to a thread that is 7+ years old, and you addressed a member who has not visited the communities for 3+ years.

 

Please post your question in a new thread, supply usable example data, and include your proc report code and the code you use to send one email to one manager. From there we can assist in sending multiple mails.

BrahmanandaRao
Lapis Lazuli | Level 10
Please give solution if any documentation for email reporting after prepare proc report

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 6 replies
  • 1914 views
  • 1 like
  • 4 in conversation