C
- Can I create an Excel Workbook containing the metadata for all datasets in a library?
The metadata for datasets can be obtained using the DATASETS procedure with he CONTENTS statement and directing the output to a dataset. Use ODS TAGSETS.EXCELXP ... - Can I get SAS to create pop-up message boxes in Windows?
Using Display Manager commands allow you to create pop-up boxes which enable you to issue bespoke messages to the user. Create a 'utility' macro program which will ... - Can I submit DOS commands from SAS and see the results in the LOG?
One method for passing a DOS command to the host system is to use the PIPE option in a FILENAME. A utility macro programme to issue a DOS ... - Can I 'inject' native HTML code into an ODS report?
The Output Delivery System opens up great possibilities for sharing generated reports. To increase the flexibility of the reports generated by, for example the ODS ... - Can I use the FIRSTOBS= and OBS= options in PROC SQL?
Yes, but there are two PROC SQL options which you might also want to consider. The FIRSTOBS= and OBS= options are normally used on a SET ... - Can I stop SAS from reading lines from a csv file where all values are missing?
Sometimes when generating a CSV file, e.g. from an Excel Spreadsheet there may be lines in the file which consist of nothing but the field ... - Can I exclude certain columns from the select * clause?
The simple answer is no: there is no SQL equivalent to the DROP= dataset option on a SET or MERGE statement to exclude only a few ... - Can I count instances of values stored in a group of variables in an observation?
As with most things in SAS, the simple answer is "Yes!". A combination of functions allow you to create a concatenated string from all of the ... - Can I count instances of values with mixed response types stored in a group of variables in an observation?
Counting simple boolean Y | N or 1 | 0 responses is fairly straighforward in SAS, however where the responses are more complex some additional ... - Can I stop the "WARNING: This CREATE TABLE statement recursively references the target table. A consequence of this is a possible data integrity problem" message when creating a table in PROC SQL?
WARNING and ERROR messages in SAS serve a useful purpose, but there are certain situations where the message is known, anticipated, and it may be ... - Can I use the automatic variables _n_ and _error_ in PROC steps?
We are used to using the automatic variables _n_ to identify the iteration count, or the boolean _error_ variable to identify data / logic errors when performing DATA ... - Can I use the colon modifier to create a 'begins with' list of variables on a SELECT clause in PROC SQL?
No. Shame though - it's a really handy way to save typing long lists of repetitive variables! Submitting the code: proc sql ; select unit: from sashelp.applianc ... - Can I validate a postcode using SAS without a lookup to the postcode database?
While it is possible to obtain a copy of the 1.8M postcodes currently in use in the UK, and merge these against the desired field ... - Can I suppress the 'DISARM' messages in the SAS LOG?
Yes, simply set the system option: options armsubsys = (arm_none) ; ... - Can I use MACRO language statements like %IF in open code?
Historically these MACRO language statements could only be used within a MACRO program definition which led to many developers contriving MACRO programs just to use ... - Can I retrieve metadata from an empty dataset?
Whn a dataset contains values, the normal experience is that the dataset is processed sequentially, and values can, for example, can be retrieved and stored ... - Can SAS identify the last-created dataset?
Macro Variable It is possible to omit the DATA= option from a PROC statement, and the system will then use the last-created dataset for processing. The stored ... - Can I delete observations from a dataset where all values are missing?
Yes. A perfect example of a utility macro which retrieves the number of variables in the dataset, counts the number of missing character / numeric variables ... - Can I export a dataset to a CSV file?
There are several ways to do this. This utility macro allows you to specify various paramaters, and validates these before generating the output file. %macro ds2csv ... - Can I create a password-protected Excel spreadsheet using tagsets.excelxp?
No the XML file generated by the ExcelXP tagset does not support passwords, however the following code can generate a VB script which can be ... - Can I keep all of the repeating GROUP / ORDER values in PROC REPORT?
PROC REPORT is a hugely versatile reporting procedure and comes with a number of inbuilt features - for example when a column is defined as ... - Can I write my own SAS date formats?
Yes, this is possible using the PICTURE format in conjunction with date / time directives. For example there is a system defined format YYQw. which writes ... - Can I create a macro variable longer than 65,534 bytes?
Well, no... The maximum length of a macro variable is restricted to the 65,534 characters, just like the maximum length of a character variable in ... - Can I dynamically create a sub-directory and assign a LIBREF to it?
How cool would that be! Imagine that you have a need to create a new sub-directory to store data for each run of your code, ... - Can I read in multiple raw data files in a single pass without hard-coding all the names?
None of us enjoys having to code for multiple references - even with the ease of copy / paste there's still the possibility of mis-keying. If ... - Can I produce a report to show the run-time of my SAS Program?
Yes. Treat the SAS LOG as a raw data file and it is quite possiblt to read in the run time and cpu time data. ... - Can I write SAS dates in bespoke formats?
There are a series of Date-Time directives (listed elsewhere on the site) which can be used to build bespoke formats using the PICTURE statement and ...