Tag: macro

A SAS data miner without Enterprise Miner

SAS Enterprise Miner (EM) is indeed a fancy tool for a SAS programmer who wants to switch to the field of data mining. It is like the point-and-click camera: you drag several nodes onto the diagram, run it and everything is settled. And I was quite i…

Proc Fcmp(2): a subroutine for Binomial-CRR model

Problems: Quote for six-month American style euro currency options on plain vanilla, Max[S-K,0]and 〖Max[S-K,0]〗^0.5. Exchange rate S_0=$1.3721 /euroSix-month continuously compounded inter-bank rates: r=0.4472%,r_f=1.2840%.Assumptions:The exchange r…

Use DO WHILE to read in every word in a string

%local cnt tword ntot1;%let cnt=1;%let tword=%qscan(&tstring,&cnt,%str( ));%* let ntot1=%qscan(&tcount,&cnt,%str( ));%do %while(&tword ne);&nbsp &nbsp &nbsp data _null_;&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp set &dir..&dsn;&nbsp &nbsp &nbsp &nbsp &nbsp &n…

Rename all vars in a dataset using SASHELP

*Create a temporary dataset… DSN;data dsn;a=1;b=2;c=3;d=4;e=5;f=6;run;%macro test(lib,dsn);*/1)*/ data _null_;&nbsp &nbsp &nbsp set sashelp.vtable(where=(libname=”&LIB” and memname=”&DSN”));&nbsp &nbsp &nbsp call symput(‘nvars’,nvar);run;*/2)*/ data …

!= does not == ne

In general, the more programming languages you work with, the better you are going to become as a programmer. I try to work with a new language about every year, so I can stretch my little brain in lots of different directions.However, the downside is…

Dump wide table to HTML report (SAS)

This SAS macro dumps a data set with many variables to an HTML report in a single line of SAS code. It’s useful on wide data sets (or in database speak, a wide table with many columns), with long character values, or where the customer needs to f…