Tag: SAS Code

SAS Stratified Random Sample

There are many ways to take a stratified random sample (SRS), but we find the it doesn’t always come out as expected. That was until we started using some examples we found in a paper by Diana Suhr. This is a great example of sampling with various numbers of strata. Example #1 PROC FREQ DATA […]

Proc SQL and the power of select into

I have referenced this paper many times. Great help in using the power of proc sql with macro variables. Great for building lists of values and dynamic code.
http://www.nesug.org/Proceedings/nesug97/coders/eddlesto.pdf
Syntax:
SELECT object-item …

How to send an email from SAS to members of a distribution list

In your organization, are you prevented from using the email alias of a distribution list (e.g. groupname@comp.domain.com), and would therefore like to extract the list recipients into a flat file to loop through/use the SAS Enterprise Miner functions,…

3 gifts to magically transform your data

‘Tis the season to be gifting!  So what could be better than gifting your fellow SAS user or yourself with three gifts to celebrate the holiday season? As 2012 comes to an end, we think it’s a great idea to be thinking of ringing in the New Year w…

Accessing files via SFTP in SAS

Secure File Transfer Protocol has become the standard for transferring files outside our organization. However, it is not always the easiest thing to do in SAS. Here are a few code examples for you to steal. Importing a CSV file over SFTP: %let host=afhood.com; %let sftpOption=-o IdentityFile=/home/user/.ssh/id_rsa; %let filename=theFile.csv; %let sftpPath=/home/remoteuser/dir/; filename myfile sftp “&sftpPath.&filename.” […]

SAS Altlog option

If you run a production SAS environment or even a development environment for that matter, it is nice to have a specific location for all logs to be written and managed. ALTLOG helps achieve this. The ALTLOG option can be set numerous ways, but we typically utilize 2. 1. As an option on the command […]

Making SOAP calls from SAS! Integrating with web services

One of the issues with SAS for many IT departments is the lack of integration with service oriented architecture (SOA). The good news is with many new features coming online with versions 9.X+ are service oriented. Lets look quickly at the Proc SOAP procedure now available. For those SAS programmers out there that aren’t familiar with […]

SQL tip – Inner join shorthand with USING

We write a LOT of SQL here and although SQL is a powerful database language, it can be tedious. So here is one tip for shortening all that typing. Typical join sytax: select some_columns from one_table join another_table on one_table.column_1 = another_table.column_1 and one_table.column_2=another_table.column_2 where some_column > someother_column ; Not too bad, right? In order for […]