SAS Tutorial | Using SAS Macro Variable Lists to Create Dynamic Data-Driven Programs

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ต.ค. 2024

ความคิดเห็น • 37

  • @kentlewan
    @kentlewan 4 ปีที่แล้ว +3

    Hey Josh, I watched the rest of this video, and learned something I immediately incorporated into my SAS report (a "vertical list".) Great presentation - and thanks!

  • @jessicasonbert6967
    @jessicasonbert6967 ปีที่แล้ว

    Thanks so much for posting - very helpful!

    • @SASUsers
      @SASUsers  ปีที่แล้ว

      Absolutely! Glad you enjoyed this piece!

  • @azulmii
    @azulmii 3 ปีที่แล้ว +2

    Great and usefull. Thanks!

    • @SASUsers
      @SASUsers  3 ปีที่แล้ว

      Thanks for the positive feedback!

  • @ashleymccook-veal1202
    @ashleymccook-veal1202 4 ปีที่แล้ว +1

    Great presentation, I've learned so much in a brief period of time. I'm relatively a beginner when it comes to SAS macro and I feel like a lot of the dots are connecting. Also, you're right about the Carpenter book. I've only read section one but I'm definitely ready to finish the book after watching this.

    • @SASUsers
      @SASUsers  4 ปีที่แล้ว

      Thanks for your great feedback, Ashley!
      Check out our #SAS Macro Language Focus Area for even more resources 2.sas.com/6058GfL1q Be sure to explore all of the tabs there so you don't miss anything!
      Some of our favorites:
      Documentation > SAS 9.4 Macro Language Reference > Getting Started with the Macro Facility 2.sas.com/6059GfL1S
      Communities: SAS Programming: DATA Step, Macro, Functions and more 2.sas.com/6050GfL1s
      Tip Sheet: SAS Macro Language Processing (PDF): 2.sas.com/6051GfL1t
      Wishing you much ongoing Macro & #SASsuccess!

  • @dominicmutiso1502
    @dominicmutiso1502 2 ปีที่แล้ว

    I enjoyed this. proc sql is simply amazing

    • @SASUsers
      @SASUsers  2 ปีที่แล้ว

      Awesome, glad you liked it!

  • @sunilgupta2156
    @sunilgupta2156 4 ปีที่แล้ว +1

    Great tutorial Joshua!

  • @kirkpaullafler2230
    @kirkpaullafler2230 4 ปีที่แล้ว +1

    Great tutorial, Josh!

  • @nethajis5494
    @nethajis5494 4 ปีที่แล้ว +1

    All the contents where really helpful thanks a lot.

    • @SASUsers
      @SASUsers  4 ปีที่แล้ว

      You're very welcome!

  • @tamarabarker
    @tamarabarker 4 ปีที่แล้ว +1

    Great tutorial! A suggestion for this channel's moderators - Please include a link to the workshop files in the content description for this and any similar recording referencing provided files. I don't see it anywhere in the content description, so it's unclear where to get the files that Joshua has made available for viewers.

    • @SASUsers
      @SASUsers  4 ปีที่แล้ว +1

      Thanks for your feedback, Tamara - we appreciate it, and we are checking into getting the files for you!

    • @SASUsers
      @SASUsers  4 ปีที่แล้ว

      Okay Tamara -- we added the files to our SAS Global Forum GitHub, and put a link in the description. Thanks for the feedback!

  • @riteshchaudhary9776
    @riteshchaudhary9776 3 ปีที่แล้ว +1

    hey, I have a doubt in exercise 1. If i want the price of every individual model of acura to be stored in macro variable and then display it in new column. How is that possible. Do i have to declare seperate macros for evey model under acura.???

    • @SASUsers
      @SASUsers  3 ปีที่แล้ว

      Thank you for your inquiry! We are checking on this for you!

    • @SASUsers
      @SASUsers  3 ปีที่แล้ว +1

      Ritesh, Exercise 1 only shows how to take one value for one Model for Acura and put it into one macro variable. If you are interested in creating a separate macro variable that holds the value of the price (either MSRP or Invoice from SASHELP.CARS) for very model for Acura, that would involve different coding technique. In terms of the video, it would be most similar to Exercise #4 "Creating a Vertical Macro Variable List Using PROC SQL" and with the DATA Step, similar to Exercise #6 "Creating a Vertical Macro Variable List Using the DATA Step".


      Here is some code you can run to show you how this could be done.

      /* Similar to Exercise 4 */
      proc sql noprint;
      select msrp into :AcuraMSRP1-
      from sashelp.cars
      where make="Acura"
      order by msrp ;
      %let nummodels=&sqlobs;
      quit;

      /* List the values of the vertical macro variable list created by SQL*/
      %put NOTE: &=AcuraMSRP1 &=AcuraMSRP2 &=AcuraMSRP3 &=AcuraMSRP4 &=AcuraMSRP5 &=AcuraMSRP6 &=AcuraMSRP7 &=nummodels;

      /* Similar to Exercise 6 */
      proc sort data=sashelp.cars out=sortedAcura;
      by msrp;
      where make="Acura";
      run;


      data _null_;
      set sortedAcura end=eof;
      call symputx(cats('A_MSRP',_n_),MSRP);
      if eof then call symputx('Num_Models',_n_);
      run;

      /* List the values of the vertical macro variable list created by DATA Step*/

      %put NOTE: &=A_MSRP1 &=A_MSRP2 &=A_MSRP3 &=A_MSRP4 &=A_MSRP5 &=A_MSRP6 &=A_MSRP7 &=Num_Models;

  • @dominicmutiso1502
    @dominicmutiso1502 2 ปีที่แล้ว

    Is this content thorough with everything offered in SAS Macro Language 1: Essentials or do I have to follow the SAS Macro Language 1: Essentials in SAS/Coursera platform?

    • @SASUsers
      @SASUsers  2 ปีที่แล้ว

      Checking on this for you!

    • @SASUsers
      @SASUsers  2 ปีที่แล้ว

      This video content covers a small portion of the material in the full SAS Macro Language 1: Essentials SAS course/SAS Macro Language Coursera course.

    • @dominicmutiso1502
      @dominicmutiso1502 2 ปีที่แล้ว

      @@SASUsers thank you

  • @adityavarma1792
    @adityavarma1792 4 ปีที่แล้ว

    Nice presentation 👍

    • @SASUsers
      @SASUsers  4 ปีที่แล้ว

      We're glad you enjoyed it!

  • @rohitwalopkar6953
    @rohitwalopkar6953 2 ปีที่แล้ว

    how to save a filepath by macro variable??
    is it like %let outpath(or any other name)="location" coz this code is not working, when I am using code ods excel file = "&otpath/xyz.xlsx" ; (and other codes after it) the excel file is not getting saved in location and I cannot export it.
    Currently doing sas coursera course and Im stuck at this problem please reply...

    • @SASUsers
      @SASUsers  2 ปีที่แล้ว

      Thank you for contacting SAS. Coursera students are encouraged to take advantage of the Discussion Forums offered as part of the course. You can find the Discussion Forums for your course by logging in to Coursera, going to your class, and then looking on the left for the Discussion Forums link. Note that these forums are monitored by SAS Curriculum Consultants, and they can provide information or direct you in another way as needed.

  • @kentlewan
    @kentlewan 4 ปีที่แล้ว +1

    Why just use 1 ampersand when you can use 3? :-)

  • @rimalmahesh
    @rimalmahesh 4 ปีที่แล้ว

    Great resource

    • @SASUsers
      @SASUsers  4 ปีที่แล้ว

      Thanks for sharing - we're glad you enjoyed the content!

  • @priyap5827
    @priyap5827 4 ปีที่แล้ว

    can you please zoom the code from next time, please?

  • @riteshchaudhary9776
    @riteshchaudhary9776 3 ปีที่แล้ว

    Hi SIr,
    I have doubt in extracting the macro variables created. I am using the following code to populate new column using the vertical macro list created for class. but in the logs i can see each name is being taken but in the output column only the last name is displayed in every record. Kindly help.
    Also tell the use of %macro name you are using after we end the macros.Thanks
    %macro rts;
    proc sql ;
    select distinct name into :name1-
    from sashelp.class;
    %let observations= &sqlobs;
    quit;
    %do i=1 %to &observations;
    data class_names;
    set sashelp.class;
    newname="&&name&i";
    %put &name1;
    run;
    %end;
    %mend rts;
    %rts;

    • @SASUsers
      @SASUsers  3 ปีที่แล้ว

      Ritesh, thank you for your inquiry! We are researching this and will get back to you!

    • @SASUsers
      @SASUsers  3 ปีที่แล้ว

      Unfortunately, we cannot provide code or screen shots or do detailed debugging in this TH-cam feedback area. There is a very similar program to the one you are constructing at time stamp 1:11:55 in the video, where the presenter is using a macro %DO loop to create a unique output dataset for each value of the &ORIGIN macro variable. Note that in his program, he uses the indirect reference data cars_&&origin&i to create the datasets 2.sas.com/6056yrRre_ASIA, 2.sas.com/6056yrRre_EUROPE and 2.sas.com/6056yrRre_USA. Your best resource for debugging your program is to either open a track with SAS Tech Support or post in the Community Forum for SAS Programming questions, here: 2.sas.com/6057yrRr5 . To open a track with Tech Support, fill out the form at this link: 2.sas.com/6058yrRrg .

  • @iam007richie
    @iam007richie 3 ปีที่แล้ว +1

    Not to be an ass but SAS reduce your licensing fees man. My firm is forcing everyone to learn "R" and "Python" and slowly reducing the dependence on SAS.
    Either lower your fees or do something that "R" and "Python" can't do

    • @SASUsers
      @SASUsers  3 ปีที่แล้ว

      We would love to talk with you more about your current license set up to make sure you are getting the most out of SAS. Please email SAS_Cares@sas.com and include your contact information including your company name and country, so we can follow up!