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.


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

@Anandkvn 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.

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

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