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

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1708 views
  • 2 likes
  • 3 in conversation