BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Yavuz
Quartz | Level 8

Firstly thanks for all answers. iam a new student of sas programming.and want to ask a problem. I have a dataset named as 'tables' and contents 4 rows:
Tables
-----------
Orion
Clinics
Datas
Other
;

I want to do a loop. Firstly read dataset name "orion" then go to work.orion dataset and calculate something...etc. Then go to second dataset "clinics" and again calculate sth. And goes on like this. i couldnt do that. If dataset names used to be like table1 table2 table3 i can do it with macros, %do i=1 %to n.... But i couldnt succeeded with it different dataset names.thanks again

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Since you would know how to do this if the data sets were named differently, here's a link that might help:

 

http://blogs.sas.com/content/sastraining/2015/01/30/sas-authors-tip-getting-the-macro-language-to-pe...

 

 

View solution in original post

5 REPLIES 5
Reeza
Super User

The solution for this would look like:

1. Make a macro, as you've indicated that takes a single parameter - dataset name. 

2. Use call execute to call macro for each dataset. 

 

It it sounds like you're having issues with step 1? 

Astounding
PROC Star

Since you would know how to do this if the data sets were named differently, here's a link that might help:

 

http://blogs.sas.com/content/sastraining/2015/01/30/sas-authors-tip-getting-the-macro-language-to-pe...

 

 

Yavuz
Quartz | Level 8
Dear Reeza i work in a bank. And i have 60 different datasets each one has 120 columns and 16 gb.i want to get some info from each one. Datasets has unique transactions.I dont want to write 60 different macro. Dear astounding i didnt understand from blog page. Can you send me a code which is runned. Thanks
Astounding
PROC Star

No, I don't have any secrets above and beyond what was in that paper.

 

You had indicated that you knew how accomplish this task if the data set names were table1, table2, table3, etc.  This paper just shows  you have to do the same thing if the table names don't have a pattern to them.  Are you stuck on how to get a list of the data set names?

Reeza
Super User

@Yavuz wrote:
Can you send me a code which is runned. 

No. You haven't specified what you need to get working at all. 

Here's a basic tutorial on Macro's but does a good job of going through what you likely need.

 

http://www.ats.ucla.edu/stat/sas/seminars/sas_macros_introduction/

 

If you're looking for more resources I highly suggest searching lexjansen.com

 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

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
  • 5 replies
  • 915 views
  • 2 likes
  • 3 in conversation