![]() ![]() Order date, first // placing date as 1st variable * Converting variable Company from string to numericįormat Company* %10. Gen double date2 = daily(Date, "MDY", 2020)ĭrop in 1 // dropping that 1st obs (that had the variable names) * Your date variable came in as a string, this creates a Stata date variable with it * NOTE: the ` is on the key to the left of the 1 on your keyboard. In order to modify your CSV file to JStock format, here is what you need to do to understand the JStock CSV format. ![]() "Date" "Company1" "Company2" "Compan圓" "Company4" Do I need to define the variables first (date, stock, price)? I tried to reshape the data but Stata does make more than 700 variables so the reshape command does not work. the smallest 10% of firms in portfolio 1, etc), and ascol converts daily stock returns or stock prices data to weekly, monthly, quarterly, or yearly returns. For example, asreg ( SSC install asreg) let's you calculate cross-sectional returns using Fama & MacBeth (1973) two-step model, asrol calculates stock returns over a rolling window, astile will divide stocks into size-based portfolio's (i.e. Finally, once you have your data organized like that, there are a bunch of user-written commands for use with daily stock data. Tabstat close_price if year=2018 & month1=10, by(stock) stats(n mean median min max sd var) * The if year=2018 and month1=10 won't matter here, but wanted to show that you could do it | date stock close_price month1 month2 year | Gen month2 = mofd(date) // Number of months since Jan1960 Reshape long s_, i(date) j(stock) string // actually reshaping the data Rename (apple-dropbox) s_= // adding prefix s_ to the stock names so can reshape ![]()
0 Comments
Leave a Reply. |