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_code | cust_name | Revenue |
100 | a | 25000 |
100 | s | 35000 |
100 | d | 45000 |
200 | f | 6000 |
200 | f | 5000 |
100 | b | 6000 |
300 | a | 6000 |
200 | d | 5000 |
200 | f | 6000 |
300 | g | 6000 |
%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
Thanx Manoj
it worked perfectly. request you t pls explain the same code
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 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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.