Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On SAS for Data Analysis

You're reading from   Hands-On SAS for Data Analysis A practical guide to performing effective queries, data visualization, and reporting techniques

Arrow left icon
Product type Paperback
Published in Sep 2019
Publisher Packt
ISBN-13 9781788839822
Length 346 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Harish Gulati Harish Gulati
Author Profile Icon Harish Gulati
Harish Gulati
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Section 1: SAS Basics FREE CHAPTER
2. Introduction to SAS Programming 3. Data Manipulation and Transformation 4. Section 2: Merging, Optimizing, and Descriptive Statistics
5. Combining, Indexing, Encryption, and Compression Techniques Simplified 6. Power of Statistics, Reporting, Transforming Procedures, and Functions 7. Section 3: Advanced Programming
8. Advanced Programming Techniques - SAS Macros 9. Powerful Functions, Options, and Automatic Variables Simplified 10. Section 4: SQL in SAS
11. Advanced Programming Techniques Using PROC SQL 12. Deep Dive into PROC SQL 13. Section 5: Data Visualization and Reporting
14. Data Visualization 15. Reporting and Output Delivery System 16. Other Books You May Enjoy

Macros that evaluate

We know that macro variables are stored as character values. The %eval function helps evaluate integers or logical expressions. The function converts the character data to a numeric or logical expression. After performing the evaluation, it then converts the result back to a character value and returns the value.

We will now try and evaluate some macro variables:

OPTIONS SYMBOLGEN;

%Let A1 = (1+0);
%Let A2 = (1+5);
%Let A3 = (10-5);
%Let A4 = (10/5);
%Let A5 = (10/3);
%Let A6 = (1-0.1);

%Let eval_A1 = %eval(&A1);
%Let eval_A2 = %eval(&A2);
%Let eval_A3 = %eval(&A3);
%Let eval_A4 = %eval(&A4);
%Let eval_A5 = %eval(&A5);
%Let eval_A6 = %eval(&A6);

%PUT eval_A1 = &eval_A1;
%PUT eval_A2 = &eval_A2;
%PUT eval_A3 = &eval_A3;
%PUT eval_A4 = &eval_A4;
%PUT eval_A5 = &eval_A5;
%PUT eval_A6 = &eval_A6;

In the following LOG, we get the resolution...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image