Using SYSTASK to dynamically create LIBNAME statements - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

Using SYSTASK to dynamically create LIBNAME statements

Description:

Using SYSTASK to dynamically create LIBNAME statements. Ray Cloutier. Health Dialog ... Ray Cloutier. Health Dialog. rcloutier_at_healthdialog.com ... – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 16
Provided by: robrussell
Category:

less

Transcript and Presenter's Notes

Title: Using SYSTASK to dynamically create LIBNAME statements


1
Using SYSTASK to dynamically create LIBNAME
statements
  • Ray Cloutier
  • Health Dialog

2
Introduction
  • How to dynamically create LIBNAME statements

3
Consistent Directory Structure
  • Facilitates cross project analysis
  • Enables team work
  • Keeps things tighty

4
Sample Folder Structure
5
Declare Macro
macro project_analysis(working_folder ,
projects_folder )
6
Use SYSTASK to create a text file listing of
projects
systask command "ls projects_folder. gt
working_folder.all_project_folders.txt"
shell tasknameget_project_paths waitfor
get_project_paths
7
Read in the list of projects
data project_folders length project_folder
32 infile "working_folder.all_project_folder
s.txt" lrecl200 termstrcrlf input
_at_1 project_folder 32. run
8
Create a macro variable containing the list of
projects
proc sql noprint select project_folder
into projects_list
separated by ' from
project_folders quit put list of
projects projects_list
9
Parse the list of projects
let p1 / used as a counter variable. / do
while (scan(projects_list,p,str()) ne
str( )) let current_project
scan(projects_list,p,str()) put project
current_project
10
Perform a task for each project
/ ---- place task to perform for each here
---/ libname whp. "projects_folder.current_p
roject./data"
accessreadonly / ----------- end task
work -----------------/
11
Increment Counter end loop
let peval(p1) /increment the counter
/ end mend project_analysis project
_analysis (working_folder
/tmp/sandbox/projects ,projects_folder
/projects/)
12
Conclusion
  • Consistency can have great benefits
  • Find a folder structure that works for your
    projects
  • Avoid kitchen counter (catch all) folders!

13
SAS blurb slide
  • 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. Other brand and product names
  • are registered trademarks or trademarks of
  • their respective companies.

14
My Contact info
  • Ray Cloutier
  • Health Dialog
  • rcloutier_at_healthdialog.com

15
Using SYSTASK to Dynamically create LIBNAME
statements
  • Questions
  • and Answers
Write a Comment
User Comments (0)
About PowerShow.com