SAS Tutorial | Beyond the Basics of Macro

  Рет қаралды 30,410

SAS Users

SAS Users

Күн бұрын

Пікірлер: 50
@jaxlee4661
@jaxlee4661 3 жыл бұрын
Perfect video introducing all the basic information about SAS Macro! Thanks for sharing!
@SASUsers
@SASUsers 3 жыл бұрын
Glad you enjoyed it!
@beans802
@beans802 3 жыл бұрын
I could watch this man talk for far more than 2.5 hours.
@nodrogguod
@nodrogguod 4 жыл бұрын
Thanks for the vieo, two and a half hours well spent on learning!
@sanketkamat5983
@sanketkamat5983 3 жыл бұрын
Such an amazing video. Although have been using macros this video enlightened me with so many new features. Thanks for sharing this!
@SASUsers
@SASUsers 3 жыл бұрын
We're glad you enjoyed it!
@xuefeng1982
@xuefeng1982 Жыл бұрын
Thank you so much for the very detailed explanation, the best learning materials I had so far!!!
@SASUsers
@SASUsers Жыл бұрын
You're welcome, Xue, we're thrilled it was so helpful for you! Thank you for such wonderful feedback - we'll be sure to share it with John!
@jessicasonbert6967
@jessicasonbert6967 Жыл бұрын
So helpful - thank you so much for posting!!!
@femiogunyemi2688
@femiogunyemi2688 4 жыл бұрын
Thanks for the lessons ,this video l watched advance me to know more on macro work and services it provide .
@adityavarma1792
@adityavarma1792 4 жыл бұрын
Thank you. Got to learn some new ways n functions. 👍
@jinpenggao1943
@jinpenggao1943 3 жыл бұрын
It is an awesome lecture, Thanks1
@SASUsers
@SASUsers 3 жыл бұрын
Glad you liked it!
@niyazshaik4178
@niyazshaik4178 3 жыл бұрын
Great work....Thank you sir
@SASUsers
@SASUsers 3 жыл бұрын
Niyaz, glad you found it helpful!
@zbigniewz.lewandowski8629
@zbigniewz.lewandowski8629 2 жыл бұрын
Great, great and great!
@SASUsers
@SASUsers 2 жыл бұрын
So glad you found in helpful! 🙂
@dritans7334
@dritans7334 3 жыл бұрын
It was great explanation. One thing I didn't understand is why we write the column =: in this step memname=:"%upcase(&dsnstart)";
@SASUsers
@SASUsers 3 жыл бұрын
Checking on this for you!
@SASUsers
@SASUsers 3 жыл бұрын
We contacted the video presenter, and he searched through the programs used for this presentation. He could not find any reference to the code snippet you asked about: "memname=:"%upcase(&dsnstart)". Can you provide the time stamp in the video where you see a reference to the macro variable &dsnstart and the line of code you're asking about? We reviewed the section on working with dictionary.tables and dictionary.columns. One of the variables, MEMNAME, is used in that section to illustrate working with SQL dictionary tables. The values stored in the MEMNAME column are ALWAYS stored in uppercase. So in this code snippet you posted, the %upcase macro function is being used to transform the value of the macro variable &dsnstart from how it was specified originally into upper case for the purposes of the comparison. If this is not what you were asking about specifically, you'll need to let us know exactly where in the video you found the text string. Sound good?!
@dritans7334
@dritans7334 3 жыл бұрын
@@SASUsers I am sorry for not mentioning the time stamp before. I appreciate the availability you are showing. It is used in 2:17:35 time stamp, at line 5. What is the purpose of using : after = sign instead of just an equal sign? It is used and memname =: "%upcase(&dsnstart)";
@SASUsers
@SASUsers 3 жыл бұрын
Thank you. We will get back to you shortly.
@SASUsers
@SASUsers 3 жыл бұрын
Thanks for that time stamp. We found the code. The use of the colon with an = sign is unique to SAS syntax. It is a way of limiting the comparison. So for example, only the first 2 characters of the value will be compared. In the macro program, the value for &dsnstart is set to the lowercase value pr. That value needs to be used with %upcase so that the first 2 characters of the comparison look for PR. Using the =: syntax is explained on this page: 2.sas.com/6054Hi8Gp under the section on Character Comparisons. One way to think of it is like asking for a "starts with" comparison. So on the slide, the macro program will write code that can be submitted and the resolved code for the WHERE statement will look like this: where libname="SASHELP" and memname=: "PR"; As you can see, by the time the code is sent forward for execution, both of the macro program parameters, sashelp and pr, will be uppercased and the comparison of =: is telling SAS to only select data from SASHELP.VTABLE where the LIBNAME is SASHELP and the member name or table name has the first 2 characters equal to PR. This means that SASHELP.PRDSALE and SASHELP.PRICEDATA would meet these criteria, but another dataset named SASHELP.APRIL would NOT be selected because the first 2 characters are AP, not PR. (Note, if you type and run this program, there is NOT a SASHELP.APRIL dataset that name was picked for illustration purposes only.) If you want to learn more about comparison operators and the WHERE clause and the WHERE statement, we recommend the Programming 1 class, which is free as self-paced e-learning. You can read the description of Programming 1 here: 2.sas.com/6055Hi8GV . Hope this helps, Dritan!
@muhammadhesham8120
@muhammadhesham8120 2 жыл бұрын
Thank You
@muhammadhesham8120
@muhammadhesham8120 Жыл бұрын
@@fadwa2413 علي Coursera في كورس عن ال macro variables
@SASUsers
@SASUsers Жыл бұрын
مرحباً فدوى، تفضلي بالروابط التالية المتعلقة ب Macros: SAS Macro Programming for Beginners: 2.sas.com/6058Me3Wu Macro Language Trainings: 2.sas.com/6050Me3Wr
@SASUsers
@SASUsers Жыл бұрын
أهلا وسهلا بك فدوى، استمتع!
@yandisanovokoza4320
@yandisanovokoza4320 6 ай бұрын
I would have loved to access the codes if they were saved somewhere, otherwise this i real enjoyed
@SASUsers
@SASUsers 6 ай бұрын
We're glad you enjoyed it and will pass along your feedback!
@michelef406
@michelef406 2 жыл бұрын
Using the code at 13:55 as a reference, how could i print out the name of the k-th student? I tried the following code, expecting the name of the first student as an output in the log but got simply *&(student1)* ` %let k=1; %put &(student&k); ` Thanks for the video and for any answer :)
@SASUsers
@SASUsers 2 жыл бұрын
Checking on this for you!
@SASUsers
@SASUsers 2 жыл бұрын
Thanks for your question! Unfortunately, we can't post code here in the KZbin feedback area. This tutorial is derived from our Advanced Macro topics class, which assumes that you have an understanding of basic macro coding syntax. If you have taken our Macro Language 1 class 2.sas.com/6055Kb5u9 , you should review the section on resolving macro variables and you'll see that parentheses are not appropriate for the type of usage you show. A SAS Macro variable must be preceded by an & and because you put parentheses between the & and the student&k, no macro variable resolution is possible except for &k, which is why you get student1 in your parentheses in the log. In the Macro Language 1 class, we cover topics of indirect reference of macro variables that requires more than one & for the macro variable to resolve correctly. The code from time stamp 13:55 is shown again at time stamp 54:15-54:16 and you can see the correct %PUT statement to reference in the code that is being demonstrated. If you want to delay resolution of &student1, so that the &k can be resolved first, then you would need to use the macro variable reference &&student&k, as we show in the Macro Language 1 class. If you need a refresher on Macro topics, this user group paper on Macro basic concepts 2.sas.com/6057Kb5uc may be helpful. For questions like this, your best resource is our SAS Community Forums on SAS Programming 2.sas.com/6058Kb5uY, where you can post the code you've tried and ask questions about your code. Our SAS users and SAS employees monitor the Forums to help with questions like this.
@michelef406
@michelef406 2 жыл бұрын
@@SASUsers I can only be amazed by the depth and the quality of this answer. Thank you, the next time I decide to invest in my education I will remember this post :)
@SASUsers
@SASUsers 2 жыл бұрын
☺️
@srikanthreddy3454
@srikanthreddy3454 Жыл бұрын
For creating output dataset in proc means we use output out,but in proc freq we use only out,both are procedures only but why there is that difference, please explain
@SASUsers
@SASUsers Жыл бұрын
Thank you for your inquiry! We are checking in to this for you!
@SASUsers
@SASUsers Жыл бұрын
Hi Srikanth, This video discusses Macro topics, not the reasons behind differing syntax for MEANS vs FREQ. And, the fact is that there just is different syntax. The original SAS procedures were written at different times in the development of SAS and many procedures have different methods to output a data set. Basically, some procedures use the OUT= option and some use the OUTPUT statement. You need to look at the documentation for each procedure to see what the internal procedure syntax is for creating an output dataset. The fact is that there are different internal syntax methods and over time, you will get to know which method works for your procedures of choice. However, another way to create an OUTPUT dataset is to use the ODS OUTPUT statement, in conjunction with ODS TRACE to create a dataset from one or more than one of the output objects created by your procedure of choice. The nice thing about using ODS OUTPUT is that the syntax of the ODS OUTPUT statement does NOT change based on each procedure, but the output object that you are using to create the dataset will change with each procedure. You can look up the output objects used by each procedure by using ODS TRACE and researching in the documentation. Here's a good paper on the use of ODS OUTPUT: 2.sas.com/6054OOBEu .
@vvvvv432
@vvvvv432 2 жыл бұрын
Great tutorial! Just a question :Is the code material included in the video available to download?
@SASUsers
@SASUsers 2 жыл бұрын
Thank you for your inquiry! Vagelis, we are checking on this for you!
@SASUsers
@SASUsers 2 жыл бұрын
Hi Vagelis, most of the demos in this tutorial use SASHELP data sets, which are available with every SAS installation. So you should be able to run the programs without needing any extra data. The programs used by the instructor in this tutorial are not available for download. For more formal training, you might want to look at our Macro 1 2.sas.com/6053JWPa5 and Macro 2 2.sas.com/6054JWPag classes.
@srikanthreddy3454
@srikanthreddy3454 Жыл бұрын
Could you explain control flow(compile and execution)of proc step and also macros and proc sql
@SASUsers
@SASUsers Жыл бұрын
Srikanth, thank you for your inquiry! We are checking on this for you!
@SASUsers
@SASUsers Жыл бұрын
Srikanth, We detail how SAS compiles and executes code in the SAS Programming 2: Data Manipulation Techniques course. There is also a good paper SAS DATA Step - Compile, Execution, and the Program Data Vector. Charu does an excellent job explaining how PROC SQL processes in the Step-by-Step PROC SQL tutorial. We also offer SAS SQL 1: Essentials training. Check out Going Under the Hood: How Does the Macro Processor Really Work paper or SAS Macro Language 1: Essentials for more information on SAS macro processing.
@srikanthreddy3454
@srikanthreddy3454 Жыл бұрын
@@SASUsers is sas programming2 started ?,or else alredy is there can you please send me tha links
@SASUsers
@SASUsers Жыл бұрын
Yes, we do offer SAS Programming 1 as a free course. You can find a list of all of your e-learning courses here 2.sas.com/6050OyTxr
@srikanthreddy3454
@srikanthreddy3454 Жыл бұрын
%let a=one; Put &a; %put &a; What is the output of those statements
@SASUsers
@SASUsers Жыл бұрын
Thank you for your inquiry! We are checking on this for you!
@SASUsers
@SASUsers Жыл бұрын
Hi Srikanth, We are not able to post code and screen shots here in the KZbin feedback area. It should be fairly easy for you to run the code to test it in a SAS session. The challenge with the code you posted is that the DATA step PUT statement cannot be used in open code and so if you submit this statement with the other 2, you would see an error message like "ERROR 180-322: Statement is not valid or it is used out of proper order." However, the %PUT statement should insert the value of &a into the log. So, if your %LET statement assigns the string one to the macro variable &a in the Global Symbol table the the %PUT should display the string one in the SAS log. For this type of question regarding SAS Macro processing, you may want to post in the SAS Community Forum for programming and macro questions, here: 2.sas.com/6058Ou2Tq . === ===
SAS Tutorial | Getting the Most out of SAS Macro and SQL
45:30
Самое неинтересное видео
00:32
Miracle
Рет қаралды 2,6 МЛН
OYUNCAK MİKROFON İLE TRAFİK LAMBASINI DEĞİŞTİRDİ 😱
00:17
Melih Taşçı
Рет қаралды 5 МЛН
SAS Tutorial | The Fundamentals of DATA Step Programming
1:36:47
Proc template Wenting Carroll Bancova2013spring
5:26
ban cova
Рет қаралды 1,4 М.
Neo4j (Graph Database) Crash Course
1:23:08
Laith Academy
Рет қаралды 223 М.
SAS Tutorial | Step-by-Step PROC SQL
50:29
SAS Users
Рет қаралды 75 М.
A Beginners Guide to Using Arrays and DO Loops
20:23
SAS Users
Рет қаралды 18 М.