BookmarkSubscribeRSS Feed
malov0610
Calcite | Level 5


Hello, i need help. If anyone can show me on the data I attached the difference between the data and the macro code.

5 REPLIES 5
Tom
Super User Tom
Super User

You seem to have just attached datasets.

What are you asking for help with?

malov0610
Calcite | Level 5

I would like to understand the difference between data / proc steps and macro steps. I know the syntax, but when I try to write macro code I don't know how to define it exactly. If you can just show me in a simple example on my data.

Kurt_Bremser
Super User

@malov0610 wrote:

I would like to understand the difference between data / proc steps and macro steps. I know the syntax, but when I try to write macro code I don't know how to define it exactly. If you can just show me in a simple example on my data.


There are no "macro steps". The macro preprocessor enables the dynamic creation of any SAS code anywhere in a program.

 

Writing macro code starts with working non-macro code that needs to be expanded to work in different situations, or be used in multiple places.

Quentin
Super User

The purpose of the DATA step (and PROC step) is to process data.

 

The purpose of the macro language is to generate SAS code.  That SAS code is often the code for DATA steps or PROC steps which process data.

 

The macro language is a code generator.  Instead of typing SAS code yourself, you can type macro language code, and then run the macro language code in order to generate SAS code.

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.
Reeza
Super User

Have you take the first SAS e-course? I highly recommend that and its free. 

Otherwise I have a list of curated resources here to teach you specific topics, with macro tutorials towards the end of the list. 

 

https://github.com/statgeek/SAS-Tutorials/blob/master/Base_Certification_Resource_Guide.md

 

 

SAS Innovate 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 980 views
  • 2 likes
  • 5 in conversation