Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • reshape error: variable J contains all missing values

    Hello,

    I relatively new to STATA and would really appreciate some help! I am trying to covert my dataset from long to wide using below command:

    reshape wide pseudo_eventid eventcode days_from_diag_to_treat providercode providerdesc within_six_months_flag ca_of_providercode_name, i(pseudo_patientid) j(event)

    However I receive the error message "variable event contains all missing values" yet I have no missing data in this variable. Event is numeric.

    The dataset consists of 8 merged datasets and 170 variables...

    Can anybody suggest where I might be going wrong by any chance please?

  • #2
    Is event a string variable? If so, you must specify the -string- option with your -reshape- command.

    If this is not the problem, please post back with an example from your data set. Make sure the example you post reproduces the problem you are having, and be sure to include the variables that occur in your -reshape- command in the example. Use the -dataex- command to do that. If you are running version 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.


    Comment


    • #3
      I'm wondering if there is a specific reason to reshape wide in this case, since the long form tends to have, well, a better shape in most analyses.
      Best regards,

      Marcos

      Comment

      Working...
      X