BookmarkSubscribeRSS Feed
Obsidian | Level 7

Hi i have just started learning SAS programming. I found it quite different another programming languages while implementing my ideas. Somebody had suggested me learn macros, looping, and functions to implement my ideas. Please suggest me good material on the internet where I can learn SAS programming with examples. Thankyou

Super User

Do not start with macros before you have mastered the basic data step techniques, use of the most important functions (sort, means, tabulate, format, print, report, contents, datasets, transpose), and SQL. With the typical SAS courses, you start with the macro language no before at least three weeks of dealing with other aspects of SAS.

We recommend SAS skills to the level of Programming 1 and Programming 2 training before someone takes the SAS Macro Language class. I think that this recommendation is absolutely on point. The SAS Macro facility works best when you start with a working SAS program and in order to start with a working SAS program, a programmer really needs to have a solid foundation in basic SAS programming skills.

Diamond | Level 26 RW9
Diamond | Level 26



There are many learning places out there:


If you want to learn graphs, then this blog is a valuable resource:


I would certainly second @Kurt_Bremser's suggestion there.  Learn Base SAS thouroughly before moving onto advanced topics such as macro.  Macro is just a find and replce tool, but it can very quickly complicate you and make your code dreadful.  There is nothing you can do in macro which you cannot do in Base SAS.  

I would also suggest you look at different data models, transposed (data going across) and normalised (data going down), as these can again make your life a lot easier, something like reuducing your code just by moving to the other structure, then doing your processing and flipping back up.  


This forum is also a good learning place, even after 15 years I still look at some posts and think I didn't know that.  


And remember, if you can't think of something:
google search: SAS <mytopic>

Generally yields plenty of results.


Oh, finally, by other languages do you mean .net type OOP langauges, or something else?  SAS is a data based approach, so datasteps run over data observations like a loop, and procedures can do loops by using by processing - important to remember as its rare you would need to hardcode a loop in yourself.

Obsidian | Level 7

I mean R, Python, MATLAB etc. for Other languages,

Diamond | Level 26 RW9
Diamond | Level 26

Ok, well R has dataset type convention, and Python has some sort of distionary/array type setup.  So should be similar in that regards, although I don't believe either is hard typed - i.e. in SAS you need to define column lengths/formats.

Super User

If you find a specific topic you're having difficulties you can search at for user written papers on the topic. 

For example based on your question I started thinking simulations, which means I'd refer you to the paper called Don't Be Loopy by David Cassell. Or Rick Wicklins book on simulation. 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 7 replies
  • 1 like
  • 6 in conversation