Find It Using SAS By David Steves. Would you like to be able to search SAS programs for certain expressions? Example: I have a list of SAS programs which.

Slides:



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

Introduction to Data Set Options Mark Tabladillo, Ph.D. Software Developer, MarkTab Consulting Associate Faculty, University of Phoenix January 30, 2007.
1 Applying SAS Parallel- Processing Feature Berwick Chan, Kaiser Permanente Vaccine Study Center NCAL Division of Research For BASAS.
When “ANYDATE” Doesn’t Mean Any Date: A Macro Solution Charlotte King, Alberta Health Services John Fleming, Alberta Health Services SAS Global Forum Paper.
How SAS implements structured programming constructs
The INFILE Statement Reading files into SAS from an outside source: A Very Useful Tool!
SAS Programming:File Merging and Manipulation. Reading External Files (review) data barf; * create the dataset BARF; infile ’s:\mysas\Table7.1'; * open.
Examples from SAS Functions by Example Ron Cody
Chapter 9: Introducing Macro Variables 1 © Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
The Knight’s Tour in Chess – Implementing a Heuristic Solution John R Gerlach The Knight’s Tour in Chess – Implementing a Heuristic Solution John R Gerlach.
I OWA S TATE U NIVERSITY Department of Animal Science PROC ROBUSTRET & Evaluating Regression analyses With The Help of PROC RSQUARE Animal Science 500.
Axio Research Idea to Application via SAS Macro Language Reading Directories Bill Coar
A program for exporting SAS datasets to Argus Johan Heldal Statistics Norway.
Beginning Data Manipulation HRP Topic 4 Oct 19 th 2011.
Trials and Tribulations of creating DDI Codebooks at the University of Guelph A.Michelle Edwards and Carol Perry, Data Resource Centre, University of Guelph.
Merging in SAS These slides show alternatives regarding the merge of two datasets using the IN data set option (check in the SAS onlinedoc > “BASE SAS”,
Basic And Advanced SAS Programming
Data Transformation Data cleaning. Importing Data Reading data from external formats Libname/Infile/Input for text form data Proc Import for Excel/Access.
Using Proc Datasets for Efficiency Originally presented as a Coder’s NESUG2000 by Ken Friedman Reviewed by Karol Katz.
Understanding SAS Data Step Processing Alan C. Elliott stattutorials.com.
Introduction to SAS Lecture 2 Brian Healy.
Creating SAS® Data Sets
Data Cleaning 101 Ron Cody, Ed.D Robert Wood Johnson Medical School Piscataway, NJ.
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
FORMAT FESTIVAL AN INTRODUCTION TO SAS® FORMATS AND INFORMATS By David Maddox.
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.
Introduction to SAS BIO 226 – Spring Outline Windows and common rules Getting the data –The PRINT and CONTENT Procedures Manipulating the data.
RTSUG 04Feb2014: Beyond Directory Listings in SAS By: Jim Worley.
An Animated Guide©: Sending SAS files to Excel Concentrating on a D.D.E. Macro.
SAS Macro: Some Tips for Debugging Stat St. Paul’s Hospital April 2, 2007.
INTRODUCTION TO SAS MACRO PROCESSING James R. Bence, Ph.D., Co-Director Quantitative Fisheries Center Professor Department of Fisheries and Wildlife March.
SAS Efficiency Techniques and Methods By Kelley Weston Sr. Statistical Programmer Quintiles.
1 PhUSE 2011 Missing Values in SAS Magnus Mengelbier Director.
1 Back Up with Each Submit One approach for keeping a dynamic back up copy of your current work.
Bringing Data into SAS From Menu: –File –Import Data –Spreadsheet example first Pick file by browsing Select Library and Member (we will talk about this.
Macro Overview Mihaela Simion. Macro Facility Overview Definition : The SAS Macro Facility is a tool within base SAS software that contains the essential.
Lesson 2 Topic - Reading in data Chapter 2 (Little SAS Book)
1 Unknown Knowns: Database Construction from Unknown Files and Variables William Klein.
SQL Chapter Two. Overview Basic Structure Verifying Statements Specifying Columns Specifying Rows.
1 Efficient SAS Coding with Proc SQL When Proc SQL is Easier than Traditional SAS Approaches Mike Atkinson, May 4, 2005.
Chapter 3 “Working With Your Data” concerns programming in the DATA step - putting lines of SAS code between a DATA and PROC statement… Creating new variables.
Copyright © 2004, SAS Institute Inc. All rights reserved. SAS Stored Processes An analyst’s perspective Sylvain Tremblay SAS Canada 24 February 2006.
Lesson 6 - Topics Reading SAS datasets Subsetting SAS datasets Merging SAS datasets.
Introduction to SAS Macros Center for Statistical Consulting Short Course April 15, 2004.
Chapter 5 Reading and Manipulating SAS ® Data Sets and Creating Detailed Reports Xiaogang Su Department of Statistics University of Central Florida.
© OCS Biometric Support 1 APPEND, EXECUTE and MACRO Jim Groeneveld, OCS Biometric Support, ‘s Hertogenbosch, Netherlands. PhUSE 2010 – CC05 PhUSE 2010.
BMTRY 789 Lecture 10: SAS MACRO Facility Annie N. Simpson, MSc.
SAS Basics. Windows Program Editor Write/edit all your statements here. Log Watch this for any errors in program as it runs. Output Will automatically.
Writing and Reading XML files with SAS (Statistical Analysis System) What is SAS ? SAS Institute (or SAS, pronounced "sass") is an American developer of.
YET ANOTHER TIPS, TRICKS, TRAPS, TECHNIQUES PRESENTATION: A Random Selection of What I Learned From 15+ Years of SAS Programming John Pirnat Kaiser Permanente.
Controlling Input and Output
FOR MONDAY: Be prepared to hand in a one-page summary of the data you are going to use for your project and your questions to be addressed in the project.
SAS Basics. Windows Program Editor Write/edit all your statement here.
Computing with SAS Software A SAS program consists of SAS statements. 1. The DATA step consists of SAS statements that define your data and create a SAS.
Copyright © 2004, SAS Institute Inc. All rights reserved. SASHELP Datasets A real life example Barb Crowther SAS Consultant October 22, 2004.
Dynamic Generation of Data Steps on basis of Unique By-Group Permutations David Rosenfeld City of Toronto.
CC07 PhUSE 2011 Seven Sharp tips for Clinical Programmers David Garbutt Rohit Banga BIOP AG.
A Level Computing#BristolMet Session Objectives#U2S11 MUST identify built-in string manipulation functions SHOULD correctly use string manipulation functions.
Lesson 2 Topic - Reading in data Programs 1 and 2 in course notes –Chapter 2 (Little SAS Book)
Real Time Remote Access Comparing SAS and SPSS David Price Quy Do April 2013.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
Copyright 2009 The Little Engine That Could: Using EXCEL LIBNAME Engine Options to Enhance Data Transfers between SAS® and Microsoft® Excel Files William.
Using the Macro Facility to Create HTML, XML and RTF output Rick Langston, SAS Institute Inc.
Hints and Tips SAUSAG Q SORTING – NOUNIQUEKEY The NOUNIQUEKEY option on PROC SORT is a useful way in 9.3 to easily retain only those records with.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 3 & 4 By Tasha Chapman, Oregon Health Authority.
SAS Programming Introduction to SAS.
مفاهیم بهره وري.
File I/O in C Lecture 7 Narrator: Lecture 7: File I/O in C.
Retrieving Macro Variables in the DATA Step
Writing Robust SAS Macros
Presentation transcript:

Find It Using SAS By David Steves

Would you like to be able to search SAS programs for certain expressions? Example: I have a list of SAS programs which I want to search for the literal libname, because I want to see what libname statements are in the code.

libname unix1 '/home/unix1'; sample of unix1.list_programs ; Obs code map_directory 1 okagent.run /reference/code 2 okagent.sas /reference/code 3 okagent2.run /reference/code 4 okagent2.sas /reference/code 5 actinv.run /outbound_extracts/code

Sample of output Obs program directory list 1 2 okagent2.run /reference/code # as tt1 libname 3 okagent2.run /reference/code libname tt1 '/prodtemp'; 4 okagent2.run /reference/code /* change on 11/27 to spds4 libname */ 5 okagent2.run /reference/code libname gsdata sasspds "gsdata" host= "ga016dxx" 6 okagent2.run /reference/code libname ext sasspds ext" host= "ga016dxx"

data _null_; set unix1.list_programs end=no_more; call symput('mapto'||left(_n_),map_directory); call symput('program'||left(_n_),code); if no_more then call symput('pgcnt',_n_); run; %put &pgcnt.; ** Creation of SAS DATASET –no observations yet*; data all_prod; format program $35. directory $35. list $80.; run;

%macro progloop; %local i; %do i=1 %to &pgcnt; %macro search(dir,ftoconv); data tt1; infile "/source/&dir/&ftoconv." lrecl=32767 end=_eof; input; INPUT statement with no arguments. _infile_ automatic variable find_it1 = find(_infile_,'libname','I'); *I ignores Character case*; format program $35. directory $35. list $80.; program="&ftoconv."; directory="&dir."; if find_it1 > 0 then list= _infile_; if find_it1 > 0; run; proc append base=all_prod data=tt1(keep=directory program list) force; run; %mend search; %search(&&mapto&i,&&program&i); %end; %mend progloop; %progloop;

Obs program directory list 1 2 okagent2.run /reference/code # as tt1 libname 3 okagent2.run /reference/code libname tt1 '/prodtemp'; 4 okagent2.run /reference/code /* change on 11/27 to spds4 libname */ 5okagent2.run /reference/code libname gsdata sasspds "gsdata" host= " ga016dxx" 6okagent2.run /reference/code libname ext sasspds ext" host= "ga016dxx" Sample of output

Interesting points Take this code and check for other expressions Use this SAS code to scan other non-SAS programs Ability to make decisions with scan results More Info about the find function go to htm htm