Category: Base SAS


The Complete Guide to SAS Arrays

Are you looking to become a more efficient Data Step programmer? Do you often need to perform the same manipulation on multiple variables? If so, arrays are a great tool to simplify your SAS code and improve your programming efficiency. By using arrays, you can execute complex data manipulation tasks, allowing you to manipulate multiple variables with DO LOOPs and carry out a variety of data transformations with limited lines of code. This article willRead More


INSTRUCTIONS FOR CREATING TABLES AND USING CODE EXAMPLES Create the tables using the DATA steps below by copying and pasting    the code into the SAS Display Manager. Each DATA step consists of complete code and instream data. Copy and paste the PROC SQL code into the SAS Display Manager. Run the code corresponding to the selected example. READ IN THE SAMPLE DATA The following DATA step code is set up to store all files andRead More

Top 10 Most Powerful Functions for PROC SQL

PROC SQL is not only one of the many SAS procedures and also a distinctive subsystem with all common features from SQL (Structured Query Language). Equipped with PROC SQL, SAS upgrades to a full-fledging relational database management system. PROC SQL provides alternative ways to manage data other than the traditional DATA Step and SAS procedures. In addition, SAS’s built-in functions are the add-on tools to increase the power of PROC SQL. In the attached PDFRead More


How do I read/write Excel files in SAS? Reading an Excel file into SAS Suppose that you have an Excel spreadsheet called auto.xlsx. The data for this spreadsheet are shown below. MAKE                     MPG           WEIGHT          PRICE AMC                        Concord        2930               4099 AMC Pacer                17               3350               4749 AMC Spirit                 22               2640               3799 Buick Century            20               3250               4816 Buick Electra             15               4080                7827 Using the Import Wizard is an easy way to import data into SAS.  The Import Wizard can be foundRead More

PROC Export

PROC Export to Excel – Multiple tables to one xlsx file on different sheets The XLSX engine is enhanced to write multiple sheets per Microsoft Excel file in the first maintenance release of SAS 9.3. In SAS 9.3, the XLSX engine supports writing only one sheet in an Excel workbook. You can work around this by setting DBMS=EXCEL or DBMS=EXCELCS in your code. This will generate more than one sheet In the SAS 9.3 TS1M1Read More

Automatically assign libraries at startup

Library assignments can be a drag sometimes. All you want is for your libraries to be automatically assigned in your session. Can you let SAS do this? Sure, here’s how (FYI, I’m suggesting an interactive method here but if you prefer writing code, you can certainly embed multiple Libname statements in your programs to assign them at startup or even include them in your program file). Click on the New Library icon. Enter theRead More

SAS Shortcuts

Clear log, output & submit code in one keystroke Activate your function keys by typing Keys in your command window. 2. Find a function that hasn’t been programmed yet.  I’ll pick F12. 3. Type in this command: Clear Log; Clear Output; Submit;     Now run any program by hitting the F12 key or whichever key you used as your shortcut for this tip. See how it automatically clears your log, output windows and submitsRead More