code: def get_var_endog(y, lags, trend="c", has_constant="skip"):
      """
      Make predictor matrix for VAR(p) process
  
      Z := (Z_0, ..., Z_T).T (T x Kp)
      Z_t = [1 y_t y_{t-1} ... y_{t - p + 1}] (Kp x 1)
  
      Ref: Lütkepohl p.70 (transposed)
  
      has_constant can be 'raise', 'add', or 'skip'. See add_constant.
      """
      nobs = len(y)
      # Ravel C order, need to put in descending order
      Z = np.array(
          [y[t - lags : t][::-1].ravel() for t in range(lags, nobs)]
      )
  
      # Add constant, trend, etc.
      if trend != "n":
          Z = tsa.add_trend(
              Z, prepend=True, trend=trend, has_constant=has_constant
          )
  
      return Z
  
file_path: statsmodels/statsmodels/tsa/vector_ar/util.py
imports: from statsmodels.compat.pandas import frequencies
  from statsmodels.compat.python import asbytes
  from statsmodels.tools.validation import array_like, int_like
  import numpy
  import pandas
  from scipy import stats, linalg
  import statsmodels.tsa.tsatools
label_desc: Use image node_id 1 for calling a global function with example usage: get_var_endog(y, lags, trend, has_constant) and returns: Z