Thursday, October 18, 2012

4 years later

It's 2012. Remember movie "2012"? Yes, it's supposed to be the end of world. However, we are still alive.
Remember 4 years ago? I thought it's end of wall street. However, they are still alive, and well.

I read my blogs 4 years ago. Feelings start coming back to me. I have never forgotten what happened in 2008, not only because I remember it, but also because I keep visiting it back. "Too Big to Fail", is the book I read at least 3 or 4 times in last few years.

4 years back I worked in a trading firm, and watched wall street like an opportunist should be, scared and excited, waiting for my chance to rush on the last train to prosperity. It didn't work out quite well, to my misfortune. My boss retired as billionaire, and I am still nobody.

That didn't bother me though. I started working for one of biggest banks in wall street a year ago. I worked in a back office, not a quant trader any more, but a poor combination of IT and business type. It's definitely not the sexiest job in wall street. So I got out as quickly as I could. Now I started working in risk. If I got this job 4 years ago, I imagine, I would have been like in hell. Right now, hell has become business as usual.

So it ain't bad. Past days, banks have reported record earnings after financial crisis. A lot of wall street successfuls, will pocket record bonus again, thanks to higher profits and lower head counts in these firms. As a risk person, I get the blame not the bling. But I have found a more meaningful life, to keep the too big from fail.

Friday, October 28, 2011

How to create FTP path in SAS program

FILENAME FTPFILE FTP '' LS
HOST = "&FTPHST"
USER = "&FTPUSR"
PASS = "&FTPPAS"
CD = "&FTPCD\&PGMSEC";



DATA _NULL_;
INFILE FTPFILE;
INPUT;
IF _INFILE_ EQ "&PGMMTH" THEN CALL SYMPUT('LEVEL0','Y');
RUN;

FILENAME FTPFILE FTP '' LS
HOST = "&FTPHST"
USER = "&FTPUSR"
PASS = "&FTPPAS"
CD = "&FTPCD\&PGMSEC"
RCMD = "MKD &PGMMTH";


DATA _NULL_;
IF "&LEVEL0" EQ 'N' THEN
DO;
INFILE FTPFILE;
INPUT;
END;
RUN;

Thursday, October 6, 2011

SUBTOTAL -- my first VBA program

'Calculate subtotal of numeric columns below the cell selected

Option Explicit

Sub subtotal()

Dim result, data As Range
Dim lastrow As Long

If TypeName(Selection) <> "Range" Then Exit Sub

Set result = Selection

lastrow = ActiveSheet.UsedRange.Rows.Count
Set data = Range(Selection.Offset(2, 0), Cells(lastrow, result.Column))
result.Formula = "=SUBTOTAL(9," & data.Address(external:=True) & ")"
End Sub

Monday, June 6, 2011

SAS Macro: How to Retrieve a Value from a Dataset

Solution 1:

%MACRO Get_data(myDataset=,myLine=,myColumn=,myMVar=);
%GLOBAL &myMVar.;
data _null_;
set &myDataset.;
if _N_ = &myLine. then do;
call symput(symget('myMVar'),&myColumn.);
end;
run;
%MEND Get_data;

Solution 2:

%MACRO Get_data(myDataset=,myLine=,myColumn=,myMVar=);
%GLOBAL &myMVar;
proc sql noprint;
select &myColumn into :&myMVarfrom &myDatasetwhere monotonic() = &myLine;
quit;
%MEND Get_data;
%Get_data(myDataset=tablename,myLine=linenumber,myColumn=colname,myMVar=varname)
%put &varname;

Solution 3: USE SAS I/O functions!

%MACRO Get_data(myDataset,myLine,myColumn);
%global myMvar;
%let dsid=%sysfunc(open(&myDataset.,i));
%let rc=%sysfunc(fetchobs(&dsid, &myLine.));
%if &rc = 0 %then
%let myMvar=%sysfunc(GETVARN(&dsid,%sysfunc(varnum(&dsid,&myColumn))));
/****use getvarc for character variables*****/
%let rc=%sysfunc(close(&dsid));
%MEND Get_data;

MORE SAS CODES

http://www.datasavantconsulting.com/roland/Spectre/maclist2.html

Put all variables except automatic variables in a file

put (_all_)(+0);

Friday, June 3, 2011

Route SAS log and procedure ouput using PROC PRINTTO

PROC PRINTTO is very useful when we try to automate the debugging process of SAS program.

LABEL= provide a description for a SAS log or procedure output stored in a SAS catalog entry
LOG= route the SAS log to a permanent external file or SAS catalog entry
LOG= and PRINT= with same destination combine the SAS log and procedure output into a single file
NEW= replace the file instead of appending to it
PRINT= route procedure output to a permanent external file or SAS catalog entry

Using a PROC PRINTTO statement with no options closes any files opened by a PROC PRINTTO statement points both the SAS log and SAS procedure output to their default destinations.

Example:

options nodate pageno=1 linesize=80 pagesize=60 source;

proc printto log='log-file';
run;

data numbers;
input x y z;
datalines;
14.2 25.2 96.8
10.8 51.6 96.8
9.5 34.2 138.2
8.8 27.6 83.2
11.5 49.4 287.0
6.3 42.0 170.7
;

proc printto print='output-file' new;
run;proc print data=numbers;
title 'Listing of NUMBERS Data Set';
run;

proc printto;
run;

Wednesday, June 1, 2011

Second day at work!

I am so bored right now.

I still don't have access to mainframe SAS, so I can't look at codes and try out things. More important, I listened to people talking about their works, and unfortunately realized that this is not an exciting job as I had before.

When you trade, even you are not well paid, it's still exciting. But when you look at others' trading numbers, it's certainly like a whole world apart. Besides these, this job is such a long hour job, that it hardly justify the salary. OK, I admit that most people don't earn as much as I did. I was spoiled. But I feel I deserve better. Who cares what I think!

The bright spot of this job is the company title comes with it. Is this all about? Why I am here?
My manager have spent 1 hour persuading her underling to work on July 4th, now I feel sorry for her.

I hope my son Sam had a wonderful day.