©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc.

Slides:



Advertisements
Similar presentations
Effecting Efficiency Effortlessly Daniel Carden, Quanticate.
Advertisements

Copyright © 2006, SAS Institute Inc. All rights reserved. Think FAST! Use Memory Tables (Hashing) for Faster Merging Gregg P. Snell Data Savant Consulting.
Copyright © 2008 SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
Chapter 9: Introducing Macro Variables 1 © Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
P1PMF Split1 QBASIC. P1PMF Split2QBasic Command Prompt Will launch the emulator DOS operating system? Press Alt + Enter to display the widescreen.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Knowing Understanding the Basics Writing your own code part 2 SAS Lab.
Guide to extract/download multiple databases from Mainframe Tapes to PC using SAS PC Fereydoun J. Foroudian Blue Cross of California SAS is a registered.
1 Creating and Tweaking Data HRP223 – 2010 October 24, 2011 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
1 SAS SAS is a statistics software package developed by SAS Institute Inc. in U.S.A. SAS products include SAS/STAT, SAS/IML, SAS/OR, etc. The most.
Introduction to SPSS Short Courses Last created (Feb, 2008) Kentaka Aruga.
Let SAS Do the Coding for You! Robert Williams Business Info Analyst Sr. WellPoint Inc.
Computing for Research I Spring 2014 January 22, 2014.
Copyright © 2008, SAS Institute Inc. All rights reserved. SAS ® Macros: Top-Five Questions (and Answers!) Kim Wilson –Technical Support Analyst SAS Institute.
Statistical Discovery. TM From SAS. JMP ® Software: Introduction to Categorical Data Analysis.
SAS Macros ® 101 How I learned to stop worrying and love macros Alex Chaplin BCS USA Section.
Chapter 10:Processing Macro Variables at Execution Time 1 STAT 541 © Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
A Concise Display of Multiple Response Items Patrick Thornton.
Chapter 9 Producing Descriptive Statistics PROC MEANS; Summarize descriptive statistics for continuous numeric variables. PROC FREQ; Summarize frequency.
Analyzing Alcohol Behavior of San Luis Obispo County Ariana (Audi) Montes Statistics Major California Polytechnic University, San Luis Obispo Click here.
Niraj J. Pandya, Element Technologies Inc., NJ.  Summarize all possible combinations of class level variables even if few categories are altogether missing.
Prepared by: Luigi Muro – Consultant
My ODS: Real-World Uses of Modifying Table Templates Steve James Centers for Disease Control and Prevention Atlanta, Ga.
Lesson 5 - Topics Formatting Output Working with Dates Reading: LSB:3:8-9; 4:1,5-7; 5:1-4.
Copyright © 2008 SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
Multiple Uses for a Simple SQL Procedure Rebecca Larsen University of South Florida.
SAS Macro: Some Tips for Debugging Stat St. Paul’s Hospital April 2, 2007.
Copyright © 2008 SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
INTRODUCTION TO SAS MACRO PROCESSING James R. Bence, Ph.D., Co-Director Quantitative Fisheries Center Professor Department of Fisheries and Wildlife March.
Copyright © 2004, SAS Institute Inc. All rights reserved. SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries.
Essential ODS PDF Patrick Thornton.
SAS Efficiency Techniques and Methods By Kelley Weston Sr. Statistical Programmer Quintiles.
CSC 3210 Computer Organization and Programming Chapter 1 THE COMPUTER D.M. Rasanjalee Himali.
1 SAS 1-liners SAS Coding Efficiencies. 2 Overview Less is more Always aim for robust, reusable and efficient code Coding efficiency versus processing.
Introduction to SPSS. Object of the class About the windows in SPSS The basics of managing data files The basic analysis in SPSS.
Define your Own SAS® Command Line Commands Duong Tran – Independent Contractor, London, UK Define your Own SAS® Command Line Commands Duong Tran – Independent.
Chapter 16: Using Lookup Tables to Match Data 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
Macro Variable Resolution Enio Presutto York University, Toronto, Canada.
BMTRY 789 Lecture 10: SAS MACRO Facility Annie N. Simpson, MSc.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Sequencing The most simple type of program uses sequencing, a set of instructions carried out one after another. Start End Display “Computer” Display “Science”
TASS Meeting Setting GuessingRows when Importing Excel Files September 19th, 2008 Setting GuessingRows when importing Excel Files Dr. Arthur Tabachneck,
Chapter 7: Macros in SAS  Macros provide for more flexible programming in SAS  Macros make SAS more “object-oriented”, like R 1 © Fall 2011 John Grego.
An Introduction Katherine Nicholas & Liqiong Fan.
FORMAT statements can be used to change the look of your output –if FORMAT is in the DATA step, then the formats are permanent and stored with the dataset.
Chapter 17 Supplement: Alternatives to IF-THEN/ELSE Processing STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South.
1 Checking Data with the PRINT and FREQ Procedures.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapter 25 By Tasha Chapman, Oregon Health Authority.
Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
IENG-385 Statistical Methods for Engineers SPSS (Statistical package for social science) LAB # 1 (An Introduction to SPSS)
Build your Metadata with PROC CONTENTS and ODS OUTPUT Louise S. Hadden Abt Associates Inc.
Better Metadata Through SAS® II: %SYSFUNC, PROC DATASETS, and Dictionary Tables.
CCSA 221 Programming in C CHAPTER 3 COMPILING AND RUNNING YOUR FIRST PROGRAM 1 ALHANOUF ALAMR.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 5 & 6 By Ravi Mandal.
Tips for Mastering Relational Databases Using SAS/ACCESS®
A brief introduction to the topic
DEPARTMENT OF COMPUTER SCIENCE
Creating Macro Variables in the DATA Step
Macro Variable’s scope
Global and Local Symbol Tables
Retrieving Macro Variables in the DATA Step
Architecture + system-based How to assign passwords
Automate Repetitive Programming Tasks: Effective SAS® Code Generators
Robert Howard Veridical Solutions San Diego, CA
Trademark And Copyright Solution | Basic Principles Of Copyrights
Trademark, Copyright, And Patents| Specialist Intellectual Property Lawyer At Aggasso
Aggasso's Trademark Registration Solution helps to protect your firm
Presentation transcript:

©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration SYMply PUT: GET the most out of SYMPUTX and SYMGETN SYMply PUT: GET the most out of SYMPUTX and SYMGETN Robert Howard Veridical Solutions San Diego, CA

SYMply PUT: GET the most out of SYMPUTX and SYMGETN Call SYMPUTX routine SYMGETN and SYMGET functions PUT it all together: A Practical Example Presentation Outline ©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration

SYMply PUT: GET the most out of SYMPUTX and SYMGETN The CALL SYMPUTX Routine Used in the DATA step Stores values into macro variables Once stored, these values can be accessed globally throughout a program ©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration

SYMply PUT: GET the most out of SYMPUTX and SYMGETN The CALL SYMPUTX Routine Syntax: call symputx(macro-variable,value); The macro-variable argument can be: a) A character string in quotation marks b) A character variable name The value argument can be: a) A character or numeric value b) A character or numeric variable name ©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration

SYMply PUT: GET the most out of SYMPUTX and SYMGETN The CALL SYMPUTX Routine Example 1: data _null_; call symputx(thisyear,2011); call symputx(trt0,Placebo); run; %put &thisyear &trt0; The log result displays: 2011 Placebo ©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration

SYMply PUT: GET the most out of SYMPUTX and SYMGETN The CALL SYMPUTX Routine Example 2: data _null_; set dset1; call symputx(name,age); run; %put &chaz &mac &ellie &savannah &jillian &alex &ayden &quinn; The log result displays: ©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration DSET1

SYMply PUT: GET the most out of SYMPUTX and SYMGETN SYMGET and SYMGETN functions Also used in the DATA step Retrieves values of previously stored macro variables and assigns these values in programmer-defined variables SYMGET is used to retrieve character values SYMGETN is used to retrieve numeric values ©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration

SYMply PUT: GET the most out of SYMPUTX and SYMGETN SYMGET and SYMGETN functions Syntax for SYMGET: <variable>=symget(macro-variable); Syntax for SYMGETN: <variable>=symgetn(macro-variable); The macro-variable argument can be: a) The name of a macro-variable with no ampersand (within single quotes) b) The name of a variable with values that have been assigned as macro variables (no quotes) ©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration

SYMply PUT: GET the most out of SYMPUTX and SYMGETN SYMGET and SYMGETN functions Example 3: Recall previous example where &thisyear has a stored value of Since &thisyear is numeric, we will use SYMGETN data dset2; year=symgetn(thisyear); run; DSET2 ©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration

SYMply PUT: GET the most out of SYMPUTX and SYMGETN SYMGET and SYMGETN functions Example 4: data dset4; set dset3; age=symgetn(name); run; DSET3 DSET4 DSET4 is created with a new variable, AGE, which contains the corresponding values associated with each instance of NAME. ©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration

SYMply PUT: GET the most out of SYMPUTX and SYMGETN PUT it all together: A Practical Example DSET5 Calculate the number and percentages of subjects by gender for each treatment group. proc freq data=dset5 noprint; tables treat / out=trtfreq; run; TRTFREQ First obtain number of subjects in each Treatment Group. ©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration

SYMply PUT: GET the most out of SYMPUTX and SYMGETN PUT it all together: A Practical Example Using the CALL SYMPUTX routine, we assign macro variables for the value of TREAT data _null_; set trtfreq; call symputx(treat,count); run; TRTFREQ The macro variables &A and &B are assigned with values 8 and 3, respectively. ©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration

SYMply PUT: GET the most out of SYMPUTX and SYMGETN PUT it all together: A Practical Example Now well obtain the number of Male and Female subjects by Treatment Group. proc freq data=dset5 noprint; tables treat*gender / out=freq0; run; FREQ0 ©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration

SYMply PUT: GET the most out of SYMPUTX and SYMGETN PUT it all together: A Practical Example Well use the SYMGETN function to calculate the percentages FINAL data final; set freq0; percent=put(count/symgetn(treat),percent7.1); run; ©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration

SYMply PUT: GET the most out of SYMPUTX and SYMGETN simple, yet powerful tools efficient and effective method to store and retrieve macro variables use together to save time and keep program dynamic In Conclusion The CALL SYMPUTX routine and SYMGETN and SYMGET functions are: ©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration

SYMply PUT: GET the most out of SYMPUTX and SYMGETN Rob Howard Veridical Solutions P.O. Box 656 Del Mar, CA Thank you for your time and interest! ©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration