From zero to 270 lines of SAS coding and lessons learned

It’s my second week of learning to program in SAS. This week, we were introduced to the process of Data Wrangling. Data Wrangling is the process of acquiring, shaping transforming and cleansing data for analysis.

MSBA
DataScience
Data Analytics
SAS
Coding
Author

Mohit Shrestha

Published

June 3, 2019

It’s my second week of learning to program in SAS. This week, we were introduced to the process of Data Wrangling. Data Wrangling is the process of acquiring, shaping transforming and cleansing data for analysis. The image below serves as a good guideline of the analytical process to follow in creating models for solving almost all business problems in an organized manner.

Figure 1: Design Pattern

Figure 1: Design Pattern

The assignment for this week was to follow these process to code a program in SAS to perform Portfolio Analysis. I am enjoying the format of learning to code in SAS and at the same time being introduced to basic financial analytical metrics such as Sharpe Ratio used by technical traders in the real world. The Sharpe ratio is a measure of the excess return relative to the variability of the portfolio return and is calculated by:

Sharpe Ratio = (Portfolio Expected Return – Risk Free rate) / Standard Deviation of Portfolio Return

I was fascinated to learn about this simple formula, which helps investors in evaluating individual assets or diversified portfolios in order to maximize risk-adjusted returns. In just two weeks, with some guidelines from our Professor, I have moved on from knowing zero SAS code to learning to code 270 lines of SAS program to complete the portfolio analysis.

At this moment, I would like to make note of key items for future references, that I found little different/strange with learning SAS language.

Figure 2: Join & Match Merge Process

Figure 2: Join & Match Merge Process

Figure 3: RENAME Options Syntax

Figure 3: RENAME Options Syntax

Figure 4: Where VS Sub-setting IF

Figure 4: Where VS Sub-setting IF

Figure 5: Example of Proc Means Procedures Output Out= Syntax

Figure 5: Example of Proc Means Procedures Output Out= Syntax

Figure 6: Example for using Double Asterisk (**)

Figure 6: Example for using Double Asterisk (**)

I’m still trying to figure out how to best balance my time, but I was definitely better at managing my time and taking good notes this week as compared to my first week. Hope I can keep at it!

Cheers to more learning and coding!!!

Reuse

Citation

BibTeX citation:
@misc{shrestha2019,
  author = {Mohit Shrestha},
  title = {From Zero to 270 Lines of {SAS} Coding and Lessons Learned},
  date = {2019-06-03},
  url = {https://www.mohitshrestha.com.np/posts/2019-06-03-from-zero-to-270-lines-of-sas-coding-and-lessons-learned},
  langid = {en}
}
For attribution, please cite this work as:
Mohit Shrestha. 2019. “From Zero to 270 Lines of SAS Coding and Lessons Learned.” June 3, 2019. https://www.mohitshrestha.com.np/posts/2019-06-03-from-zero-to-270-lines-of-sas-coding-and-lessons-learned.

Stay in touch

If you enjoyed this post, then don't miss out on any future posts by subscribing to my email newsletter.

Support my work with a coffee

Or if you’re interested in working with me, I’m open to freelance work. You can book an appointment with me on Calendly.

Share