SlideShare a Scribd company logo
Command Line Functionality in SAS An overview of the “X” Command By Paul McDonald
Trademarks and Copyright Notices The SAS Software System  and other references to  SAS  products are trademarks of the SAS Institute, Cary, North Carolina. PKZIP  and  PKUNZIP  are products of PKWARE Inc., Brown Deer, Wisconsin Lawyer Talk!
Introduction This may come as a shock to you…  Not every task the SAS Programmer will complete is suited for the SAS Software System. Possible Tools: A)  BASE SAS B)  COBOL C)  Running Shoes
The X Command SYNTAX:   X  <'command'> ; Three examples of using the ‘X’ command Operating system commands Utility commands Higher-level executions
Operating System Commands COPY, ERASE, PRINT, MOVE, and such commands. EXAMPLES Erase a File “ Wild card characters” Conditional name
EXAMPLE:  Erase a File C:\> ERASE C:\TEMP\MYFILE.TXT X ‘ERASE C:\TEMP\MYFILE.TXT’ ;
EXAMPLE:  “Wild Card Character” C:\> ERASE C:\TEMP\*.TXT X ‘ERASE C:\TEMP\*.TXT’ ;
EXAMPLE:  Conditional Names C:\> ERASE C:\TEMP\MYFILE.TXT %LET FILENAME = MYFILE.TXT X “ERASE C:\TEMP\&FILENAME” ; Double-Quotes
Utility Commands Use PKZIP and PKUNZIP inside a program to compress space of a SAS dataset or other file. TEXAS Rhode Island PK Ware
PKZIP Example Also use with PROC DBLOAD or when creating a large file. For regular FLATFILES, consider using the PIPE= option LIBNAME OUTPUT ‘C:\TEMP’ ; DATA OUTPUT.BIGDATA (COMPRESS=YES) ; /* SAS STATEMENTS */ RUN ; X ‘PKZIP A:\ZIPPED C:\TEMP\BIGDATA.SD2’ ;
Create and Run other programs “ Using SAS to Create and Run SAS”  (Joseph M. Filip,  Proceedings , Mid-West SAS Users Group 8th Annual Conference, 1997) Create and run other programs Simple CList, REXX, or *.CMD routines Conditinal C or C++ programs Conditional COBOL programs (UGH!)
A twist on the Aforementioned Paper “ Using SAS to Create and Run SAS” uses the %INCLUDE statement Suppose you want to conditionally create and run many programs—then you may want to use the X command Allow several different programs to run concurrently.  If the system can handle it, this may be a good option.
EXAMPLE:  Sir Fax-A-Lot 500 clients at different locations  Each client is to get a one-page report every day PLAN A:  Make an intern do it PLAN B:  Fax the results directly to each recipient from SAS
EXAMPLE:  Sir Fax-A-Lot C/C++ Routine
Other considerations SAS Options XWAIT|NOXWAIT XSYNC|NOXSYNC UNIX|CMS|TSO commands
SAS Options XWAIT|NOXWAIT XWAIT-- specifies that you have to type EXIT to return to SAS session NOXWAIT-- Windows shell goes away without your typing EXIT The XWAIT option affects the shell started by any of the following: X statement (X command, CALL SYSTEM) %SYSEXEC statement
SAS Options XSYNC|NOXSYNC XSYNC-- synchronous execution NOXSYNC-- asynchronous execution The value of this option affects the execution of the following: X statement (X command, CALL SYSTEM routine) %SYSEXEC statement
CMS|UNIX|VMS Commands Left-over from previous versions of SAS Work just like the X Command except they are ignored outside the respective operating system Normally it is best to use the X command rather than the CMS|UNIX|VMS commands.
Conclusion The X command  is a versatile system function for the SAS Software System.  can do the following run basic commands,  run utility packages kick off separate SAS sessions Use the X command more and make your programs more robust
References, Sources Cited, and Credits Filip, Joseph M, “Using SAS to Create and Run SAS,”  Proceedings , 8th Annual Conference of the Mid-West SAS Users Group, 1997, page 147-148 Certain text selected from SAS HELP Session, SAS v 6.12 for Windows 95 Special Thanks to PKWARE in Brown Deer, Wisconsin!
About the Author SPIKEware, Inc. 115 ½ West Main Street West Dundee, IL  60118 Phone (847) 428-6250 Fax (847) 428-6270 SPIKEware, Inc. is a consulting firm dedicated to helping other people solve their problems through technology.  We specialize in providing solutions for our customers through the SAS Software System. http://www. SPIKEware .com/ Paul D. McDonald is the CEO of SPIKEware, Inc. and has been a SAS programmer since 1993. Paul has an A.A. in Electrical Engineering from Cloud County Community College, a B.A. in Physics from Southwestern College, and an M.B.A. in Finance from Keller Graduate School of Management. Paul can be reached by e-mail at  PDM@ SPIKEware .com

More Related Content

PPTX
Champion And V Series Presentation
PDF
TBA on China Procurement 25 FEB 2013
PPT
To Blog Or Not To Blog
PDF
Ts0705 Zenske Portaly
PDF
The China Analyst - September 2011
PDF
11 winston asiedu inkumsah finalpaper
PPT
Leveraging Open Source to Manage SAN Performance
PPTX
IASA Atlanta September 2009
Champion And V Series Presentation
TBA on China Procurement 25 FEB 2013
To Blog Or Not To Blog
Ts0705 Zenske Portaly
The China Analyst - September 2011
11 winston asiedu inkumsah finalpaper
Leveraging Open Source to Manage SAN Performance
IASA Atlanta September 2009

Similar to SAS X (20)

PDF
CSS with superpowers - SASS!
 
PPT
Mainframe Architecture & Product Overview
PPT
QSpiders - Cloud computing(cloud server)
PDF
Dispositivos en SAP
PPT
Cast Iron Cloud Integration Best Practices
PPTX
Enterprise Desktops Well Served - a technical perspective on virtual desktops
PDF
Best Practices for Building Open Source Data Layers
PDF
Command line for the beginner - Using the command line in developing for the...
PDF
SpringOne Tour St. Louis - Serverless Spring
PDF
D2S1T2N4_saurabh
PDF
@Agawish creating a stunning ui with oracle adf faces, using sass
PDF
Research Assignment For Active Directory
PPTX
Automated server farm installation using psconfig and stsadm dm300 - curry ...
PDF
Galvanise NYC - Scaling R with Hadoop & Spark. V1.0
PPT
Prog1 chap1 and chap 2
PPTX
SAS on Your (Apache) Cluster, Serving your Data (Analysts)
PDF
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
PPTX
Microsoft Windows Azure - Cloud Platforms Today A Comparison Presentation
PPTX
quicloud Apr 20 2010 Boulder New Tech Presentation
DOCX
Suman_Chakraborty
CSS with superpowers - SASS!
 
Mainframe Architecture & Product Overview
QSpiders - Cloud computing(cloud server)
Dispositivos en SAP
Cast Iron Cloud Integration Best Practices
Enterprise Desktops Well Served - a technical perspective on virtual desktops
Best Practices for Building Open Source Data Layers
Command line for the beginner - Using the command line in developing for the...
SpringOne Tour St. Louis - Serverless Spring
D2S1T2N4_saurabh
@Agawish creating a stunning ui with oracle adf faces, using sass
Research Assignment For Active Directory
Automated server farm installation using psconfig and stsadm dm300 - curry ...
Galvanise NYC - Scaling R with Hadoop & Spark. V1.0
Prog1 chap1 and chap 2
SAS on Your (Apache) Cluster, Serving your Data (Analysts)
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
Microsoft Windows Azure - Cloud Platforms Today A Comparison Presentation
quicloud Apr 20 2010 Boulder New Tech Presentation
Suman_Chakraborty
Ad

More from Paul McDonald (7)

PPTX
Minutes committee
PPTX
You gotta lose to really win
PPT
Seven components of personal achievement
PPT
Conflict resolution and the evaporating cloud
PPTX
Canadian postal codes
PPT
Statistics Primer
PPT
SAS and 80/20
Minutes committee
You gotta lose to really win
Seven components of personal achievement
Conflict resolution and the evaporating cloud
Canadian postal codes
Statistics Primer
SAS and 80/20
Ad

Recently uploaded (20)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Encapsulation theory and applications.pdf
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Mushroom cultivation and it's methods.pdf
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Tartificialntelligence_presentation.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
OMC Textile Division Presentation 2021.pptx
PPTX
1. Introduction to Computer Programming.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
TLE Review Electricity (Electricity).pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Encapsulation theory and applications.pdf
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Mushroom cultivation and it's methods.pdf
Heart disease approach using modified random forest and particle swarm optimi...
cloud_computing_Infrastucture_as_cloud_p
A comparative analysis of optical character recognition models for extracting...
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Programs and apps: productivity, graphics, security and other tools
Tartificialntelligence_presentation.pptx
Network Security Unit 5.pdf for BCA BBA.
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
OMC Textile Division Presentation 2021.pptx
1. Introduction to Computer Programming.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...

SAS X

  • 1. Command Line Functionality in SAS An overview of the “X” Command By Paul McDonald
  • 2. Trademarks and Copyright Notices The SAS Software System and other references to SAS products are trademarks of the SAS Institute, Cary, North Carolina. PKZIP and PKUNZIP are products of PKWARE Inc., Brown Deer, Wisconsin Lawyer Talk!
  • 3. Introduction This may come as a shock to you… Not every task the SAS Programmer will complete is suited for the SAS Software System. Possible Tools: A) BASE SAS B) COBOL C) Running Shoes
  • 4. The X Command SYNTAX: X <'command'> ; Three examples of using the ‘X’ command Operating system commands Utility commands Higher-level executions
  • 5. Operating System Commands COPY, ERASE, PRINT, MOVE, and such commands. EXAMPLES Erase a File “ Wild card characters” Conditional name
  • 6. EXAMPLE: Erase a File C:\> ERASE C:\TEMP\MYFILE.TXT X ‘ERASE C:\TEMP\MYFILE.TXT’ ;
  • 7. EXAMPLE: “Wild Card Character” C:\> ERASE C:\TEMP\*.TXT X ‘ERASE C:\TEMP\*.TXT’ ;
  • 8. EXAMPLE: Conditional Names C:\> ERASE C:\TEMP\MYFILE.TXT %LET FILENAME = MYFILE.TXT X “ERASE C:\TEMP\&FILENAME” ; Double-Quotes
  • 9. Utility Commands Use PKZIP and PKUNZIP inside a program to compress space of a SAS dataset or other file. TEXAS Rhode Island PK Ware
  • 10. PKZIP Example Also use with PROC DBLOAD or when creating a large file. For regular FLATFILES, consider using the PIPE= option LIBNAME OUTPUT ‘C:\TEMP’ ; DATA OUTPUT.BIGDATA (COMPRESS=YES) ; /* SAS STATEMENTS */ RUN ; X ‘PKZIP A:\ZIPPED C:\TEMP\BIGDATA.SD2’ ;
  • 11. Create and Run other programs “ Using SAS to Create and Run SAS” (Joseph M. Filip, Proceedings , Mid-West SAS Users Group 8th Annual Conference, 1997) Create and run other programs Simple CList, REXX, or *.CMD routines Conditinal C or C++ programs Conditional COBOL programs (UGH!)
  • 12. A twist on the Aforementioned Paper “ Using SAS to Create and Run SAS” uses the %INCLUDE statement Suppose you want to conditionally create and run many programs—then you may want to use the X command Allow several different programs to run concurrently. If the system can handle it, this may be a good option.
  • 13. EXAMPLE: Sir Fax-A-Lot 500 clients at different locations Each client is to get a one-page report every day PLAN A: Make an intern do it PLAN B: Fax the results directly to each recipient from SAS
  • 14. EXAMPLE: Sir Fax-A-Lot C/C++ Routine
  • 15. Other considerations SAS Options XWAIT|NOXWAIT XSYNC|NOXSYNC UNIX|CMS|TSO commands
  • 16. SAS Options XWAIT|NOXWAIT XWAIT-- specifies that you have to type EXIT to return to SAS session NOXWAIT-- Windows shell goes away without your typing EXIT The XWAIT option affects the shell started by any of the following: X statement (X command, CALL SYSTEM) %SYSEXEC statement
  • 17. SAS Options XSYNC|NOXSYNC XSYNC-- synchronous execution NOXSYNC-- asynchronous execution The value of this option affects the execution of the following: X statement (X command, CALL SYSTEM routine) %SYSEXEC statement
  • 18. CMS|UNIX|VMS Commands Left-over from previous versions of SAS Work just like the X Command except they are ignored outside the respective operating system Normally it is best to use the X command rather than the CMS|UNIX|VMS commands.
  • 19. Conclusion The X command is a versatile system function for the SAS Software System. can do the following run basic commands, run utility packages kick off separate SAS sessions Use the X command more and make your programs more robust
  • 20. References, Sources Cited, and Credits Filip, Joseph M, “Using SAS to Create and Run SAS,” Proceedings , 8th Annual Conference of the Mid-West SAS Users Group, 1997, page 147-148 Certain text selected from SAS HELP Session, SAS v 6.12 for Windows 95 Special Thanks to PKWARE in Brown Deer, Wisconsin!
  • 21. About the Author SPIKEware, Inc. 115 ½ West Main Street West Dundee, IL 60118 Phone (847) 428-6250 Fax (847) 428-6270 SPIKEware, Inc. is a consulting firm dedicated to helping other people solve their problems through technology. We specialize in providing solutions for our customers through the SAS Software System. http://www. SPIKEware .com/ Paul D. McDonald is the CEO of SPIKEware, Inc. and has been a SAS programmer since 1993. Paul has an A.A. in Electrical Engineering from Cloud County Community College, a B.A. in Physics from Southwestern College, and an M.B.A. in Finance from Keller Graduate School of Management. Paul can be reached by e-mail at PDM@ SPIKEware .com