

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. " " "7975.78" "105.07" "86.84999999999999" "15.74"Ĭode: * Loop to rename all variables to their value in the first row (1st obs) In order to modify your CSV file to JStock format, here is what you need to do to understand the JStock CSV format. 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.
#Jstock import issue install
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
