SAS Tutorial | 3 Steps to Build a SAS Macro Program

Sdílet
Vložit
  • čas přidán 15. 07. 2024
  • Who doesn’t want code that rewrites itself? Enter the SAS Macro Language. Say you’re running a SAS program routinely but need to make specific modifications each time. A SAS macro program could make those changes for you. In this SAS How To Tutorial, SAS’ Stacey Syphus breaks down how to build a SAS macro program into 3 steps: creating a macro program, using macro parameters and executing code conditionally.
    Download Data Files
    See SASHELP.CARS data sets in SAS.
    Chapters
    0:00 - The SAS program scenario that may need the SAS macro language
    2:20 - Creating and calling a macro program
    4:11 - Use macro parameters to substitute values
    8:42 - Execute code conditionally
    Learn more about SAS Software
    ◉ SAS Macro Language 1: Essentials Course - support.sas.com/edu/schedules...
    ◉ Understanding and Using the Macro Facility (documentation) - go.documentation.sas.com/?doc...
    ◉ Numeric values and intervals in SAS Macro Programming - communities.sas.com/t5/SAS-Co...
    ◉ Multi-purpose macro function for getting information about data sets -
    blogs.sas.com/content/sgf/202...
    SUBSCRIBE TO THE SAS USERS CZcams CHANNEL #SASUsers #LearnSAS
    czcams.com/users/SASUsers?sub_...
    ABOUT SAS
    SAS is a trusted analytics powerhouse for organizations seeking immediate value from their data. A deep bench of analytics solutions and broad industry knowledge keep our customers coming back and feeling confident. With SAS®, you can discover insights from your data and make sense of it all. Identify what’s working and fix what isn’t. Make more intelligent decisions. And drive relevant change.
    CONNECT WITH SAS
    SAS ► www.sas.com
    SAS Customer Support ► support.sas.com
    SAS Communities ► communities.sas.com
    SAS Analytics Explorers ► explorers.sas.com
    Facebook ► / sassoftware
    Twitter ► / sassoftware
    LinkedIn ► / sas
    Blogs ► blogs.sas.com
    RSS ► www.sas.com/rss
  • Věda a technologie

Komentáře • 69

  • @staceysyphus8238
    @staceysyphus8238 Před 3 lety +15

    Thanks so much for taking the time to watch this video! I hope you find it helpful. The SAS macro language is the best. :)

    • @MasterofPlay7
      @MasterofPlay7 Před 3 lety

      do you work for sas?

    • @staceysyphus8238
      @staceysyphus8238 Před 3 lety +1

      @@MasterofPlay7 Yes! I've been an instructor and course developer at SAS for 20 years.

    • @DheerajKumar-sw1yy
      @DheerajKumar-sw1yy Před 3 lety +1

      @@staceysyphus8238 your teaching style is awesome.. Right pace and build interest..

    • @SASUsers
      @SASUsers  Před 3 lety +1

      Awesome, thank you so much for the feedback!

    • @aditisalot1730
      @aditisalot1730 Před 3 lety

      @@SASUsers +1 for stacey

  • @hectorortiza5218
    @hectorortiza5218 Před 2 lety +1

    Felicitaciones....😊👍👍👍

  • @rodrigolalloz3773
    @rodrigolalloz3773 Před 2 lety +1

    Thanks a lot, you are so clear when talking (not only explanation, but pronunciation too)! pls keep upload more videos!

    • @SASUsers
      @SASUsers  Před 2 lety

      Thank you! We always love to hear from SAS users, and stay tuned for more content!

  • @narjissio01
    @narjissio01 Před 3 lety +2

    IS SO UNDERSTANDABLE AND VERY HELPFUL VIDEO THANKS A LOT

  • @rinrin0rikuriku
    @rinrin0rikuriku Před 3 lety +1

    I am UGLY CRYING. THIS IS SO UNDERSTANDABLE AND SAVED ME. Thank you so much!! I hope you continue to make more videos!!

  • @niyazshaik4178
    @niyazshaik4178 Před 3 lety +2

    One of the Best trainers for SAS. Thanks for uploading this video.

    • @SASUsers
      @SASUsers  Před 3 lety

      Thanks for your feedback, Niyaz, and you're welcome - we're glad you liked it!

    • @staceysyphus8238
      @staceysyphus8238 Před 3 lety +1

      Glad you enjoyed it!

  • @leben6308
    @leben6308 Před 2 lety

    Merci Stacey,

  • @rogerward8047
    @rogerward8047 Před 3 lety +2

    This is excellent. Thank you, Stacy. Thank you, SAS.

  • @sumitlandge5306
    @sumitlandge5306 Před rokem

    Very good video and very useful too

    • @SASUsers
      @SASUsers  Před rokem

      Thanks for the feedback, Sumit! Glad you enjoyed it.

  • @femiogunyemi2688
    @femiogunyemi2688 Před 3 lety +1

    Thanks macro programs is the best.

  • @arifehtesham
    @arifehtesham Před 3 lety +2

    Thank you very much for sharing the video. Everything is explained in a very simple and easy way.

    • @SASUsers
      @SASUsers  Před 3 lety +1

      Awesome! We are glad you found it helpful! 👍

  • @danvt911
    @danvt911 Před 3 lety

    I really like your videos, the explanation is clear and detail. Very useful. I hope you will do more macro videos like this.

    • @SASUsers
      @SASUsers  Před 3 lety

      Awesome! Thanks for your feedback!

  • @JoanApita
    @JoanApita Před 3 lety +2

    This is a very helpful video! This tutorial was very easy for me to understand how marco works on sas. I just learned week ago. Thank you!

    • @SASUsers
      @SASUsers  Před 3 lety

      Fantastic, and welcome to SAS! For people who are brand new to SAS, a great place to start is with our SAS Starter Kit 2.sas.com/6050GSxMe. Think of this as your one-stop-shop for resources, connecting with other SAS users, and product information.

  • @avinashprasadmahato692
    @avinashprasadmahato692 Před 3 lety +1

    Very good session with practically applied examples !

    • @SASUsers
      @SASUsers  Před 3 lety

      Thank you for the positive feedback!

  • @AlexBrazilDF
    @AlexBrazilDF Před 2 lety

    Amazing SAS Tutorial... congratulations Instrutor 🤓

  • @kamranzamanni6826
    @kamranzamanni6826 Před 3 lety +2

    Thanks for the video 👍👍

    • @SASUsers
      @SASUsers  Před 3 lety

      Certainly! We are glad you liked it! 👍

  • @itsmev0
    @itsmev0 Před 3 lety

    Thank you, as a SAS beginner it's really helpful for me to find such amazing explanations!

    • @SASUsers
      @SASUsers  Před 3 lety +1

      Awesome! We're glad the tutorial was helpful!

  • @Ujwala1010
    @Ujwala1010 Před 3 lety +1

    Good explanation 👏

  • @bryansullins2249
    @bryansullins2249 Před 3 lety +2

    Thank you.

  • @empiremediahaiti1785
    @empiremediahaiti1785 Před 3 lety

    Thank you for your tutorial

    • @SASUsers
      @SASUsers  Před 3 lety +1

      Empire, you are welcome! Glad you found it helpful!

  • @madhur089
    @madhur089 Před 3 lety +1

    You are amazing..thanks for the video :)

  • @user-ro5ox5ho2e
    @user-ro5ox5ho2e Před 3 lety +2

    thankyou. SMS!

  • @Juan-Hdez
    @Juan-Hdez Před 2 lety

    Very useful. Thank you.

    • @SASUsers
      @SASUsers  Před 2 lety

      We're so glad you enjoyed it!

  • @danilotrindade1355
    @danilotrindade1355 Před 3 lety +2

    Muito obrigado por este vídeo! (Thanks a lot for this video)!

  • @dominicmutiso1502
    @dominicmutiso1502 Před rokem

    This is good. Please do more videos on macro language topics

    • @SASUsers
      @SASUsers  Před rokem

      Thanks for sharing - noted!

  • @davidpope3574
    @davidpope3574 Před 3 lety +1

    Nice job in teaching about creating a macro program within SAS. What I really like about the SAS macro language is not only can you share this code with other SAS users, but you can learn how to turn this macro into either a stored process (in 9.4) or a SAS Job Execution job (in SAS Viya) which then allows 3rd party languages/programming to execute and or interact with the SAS process/results.

    • @SASUsers
      @SASUsers  Před 3 lety

      Thank you for your input! 👍

    • @staceysyphus8238
      @staceysyphus8238 Před 3 lety

      So true... Once you have a macro program, there are so many great ways to make this code accessible to others through a variety of applications. Thanks!

  • @DipendraKumarAyer
    @DipendraKumarAyer Před 3 lety

    Thank you very much for the video, it's really helpful. Can you please help me how to update old codes of PROC GPLOT to PROC SGPLOT for biplot graphs using macro language?

    • @SASUsers
      @SASUsers  Před 3 lety

      Thank you! We are glad you find our videos helpful! SAS Communities may be a good resource for you. You can look at #SASusers post like this one 2.sas.com/6050yDZVG or post your own questions 2.sas.com/6051yDZVH

  • @aditisalot1730
    @aditisalot1730 Před 3 lety

    I went through your two videos Stacey they were amazing but Can u teach A to Z in macro. What is the process and how to write your own macro?

    • @SASUsers
      @SASUsers  Před 3 lety

      Hi Aditi! Here are some great resources on Macros that might be helpful:
      1. SAS Documentation on Introduction to the Macro Facility: 2.sas.com/6051G4TDc
      2. SAS 9.4 Language Elements by Name, Product, and Category: 2.sas.com/6052G4TDY . From this link, you can scroll down to the section on Macros, and see a list of different types of SAS Macros alphabetically and by product.
      3. This introductory level SAS training class, SAS Macro Language 1: Essentials : 2.sas.com/6053G4TDl
      4. This introductory book, SAS Macro Programming Made Easy, Third Edition: 2.sas.com/6054G4TDm

    • @staceysyphus8238
      @staceysyphus8238 Před 3 lety +2

      The videos will help you get started, but certainly there is much more to learn about the SAS macro language! I strongly suggest taking the SAS Macro Language 1: Essentials course. There are a few different ways you can do it:
      1) Visit support.sas.com/edu/schedules.html?crs=MAC1 to see if a live course is offered in your area, either in a classroom or Live Web.
      2) Take the self-paced eLearning course through our SAS Learning Subscription. Access for the first 30 days is free: www.sas.com/en_us/training/offers/free-training.html
      3) Take the same eLearning course through Coursera. You can audit the course for free, but you will not have access to the graded assessments nor will you receive a completion certificate. If you pay to subscribe to the course in Coursera, you can have full access to those additional resources: www.coursera.org/learn/sas-macro-language
      Hope that helps!

  • @KJosue-ob5lm
    @KJosue-ob5lm Před 3 lety

    Hi! thanks for this course. Please the first resource's link is not working ... :( Could you provide us another one?
    I'm a beginner with SAS and I need to go deeper with macro programs .
    Thanks for all !!

    • @SASUsers
      @SASUsers  Před 3 lety

      Srougbo, thank you so much for your interest! Thanks for catching that, we will get it updated! In the meantime, try this link 2.sas.com/6055y8yvc

  • @hangho6654
    @hangho6654 Před 3 lety

    Thanks so much. Can I use SAS studio for the augmented backward elimination method ?

    • @SASUsers
      @SASUsers  Před 3 lety +1

      Hi! We're checking on this for you, and will follow up with more info shortly! 👍

    • @SASUsers
      @SASUsers  Před 3 lety +1

      Thanks for your patience while we checked on this!
      Yes, you can use SAS Studio for augmented backward elimination. Here is a paper that you may find useful that has a macro program that does augmented backward elimination: Microsoft Word - 20140924 ABE Technical Report.docx (2.sas.com/6054yR9E6), the program can be run in SAS Studio.

    • @hangho6654
      @hangho6654 Před 3 lety +1

      Thanks so much. I can do it now in SAS studio 😍

    • @SASUsers
      @SASUsers  Před 3 lety

      Awesome! Glad we could help!

  • @sampathkumar7633
    @sampathkumar7633 Před 3 lety

    maxprice=30000 is mentioned in first statement. The same is changed at%mend statement. Please advise

    • @SASUsers
      @SASUsers  Před 3 lety

      We are checking on this for you!

    • @SASUsers
      @SASUsers  Před 3 lety +1

      Sampath, Thanks again for your inquiry! Please re-watch the video and pay attention to the difference between positional parameters (time stamp 6:27) and keyword parameters (time stamp 7:34). At time stamp 6:27, the macro program is being defined with positional parameters. After the macro program is compiled and invoked at time stamp 6:44, you can see that the %MAXPRICE macro program is invoked with the values All,40000 as the values for the positional parameters. Then, at time stamp 7:34, the instructor explains that she is changing the positional parameters to keyword parameters and that one benefit of keyword parameters is to set defaults. So you see her specify dt=Front, maxprice=30000, and she explains that those are default values which will be used if the macro program is invoked without any overrides to those defaults. However, at time stamp 7:53, she is showing that with values of dt=All, maxprice=40000 to illustrate how to override the default values for those parameters when the macro program is invoked. Then, further, at time stamp 8:23, she explains that if she invoked the macro program WITHOUT using maxprice as a parameter, then the default of maxprice=30000 would be used, as originally defined in the %MACRO statement. There are several good books in the SAS bookstore on SAS Macro processing, by Art Carpenter and Michelle Burlew. These papers might also help you with an understanding of how macro processing works: 2.sas.com/6057HbjNb and 2.sas.com/6059HbjNd .
      === ===