Announcement

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

  • Error importing csv into Stata

    I am having trouble importing my .csv into Stata. When I imported it, the following error message appeared:


    Code:
    Note: Unmatched quote while processing row 128; this can be due to a formatting problem in the file or because a quoted data element spans
    multiple lines. You should carefully inspect your data after importing. Consider using option bindquote(strict) if quoted data spans
    multiple lines or option bindquote(nobind) if quotes are not used for binding data.
    I have tried to export the data here using dataex, but I get this error term:

    Code:
    dataex
    input statement exceeds linesize limit. Try specifying fewer variables
    r(1000);
    I have attached the excel spreadsheet as well. Any help is much appreciated.
    Attached Files

  • #2
    To clarify, the data does import, but imports incorrectly, as the error message reports.

    Comment


    • #3
      [Written after seeing your second message: Perhaps *part* of your data imported. I would still emphasize the importance, per below, of inspecting your CSV text file.]

      Stata's error message seems quite helpful. In your situation, I would look at the file using a text editor and see if there is a problem with line 128. If this is unfamiliar to you, you could copy and paste a few lines (say lines 127-129) into a message here and surround it with CODE markers so that it is displayed as text. That would enable someone to safely look at what you have. Very few people here will open a file from someone they don't know. so attaching a file is not likely to get you help here.

      -dataex- can only be used on data that is already imported into Stata, so that will not help you here.
      Last edited by Mike Lacy; 28 Apr 2020, 15:18.

      Comment


      • #4
        Thanks Mike!

        I took your advice and copy and pasted lines 127:129 here:

        Code:
        4/19/2020 9:51    4/19/2020 10:08    IP Address    68.184.146.174    100    1038    TRUE    4/19/2020 10:08    R_DSm2EwSJyrZ2orD                    34.01950073    -84.31060028    anonymous    EN    A98E8M4QLI9RS    Other    I read the instructions    0    0    65.164    0    0    0    36.899    0    0    0    8.119    0    0    0    42.988    0    0    0    49.83    0                                                                                                                                                                    Quite a bit of time    Will prioritize a great deal    Extremely closely    Quite beneficial    A little stressful    Often    Extremely valuable    Quite a bit of effort    9.81    76.844    77.693    8    Not at all difficult    Extremely important    Somewhat successfully    Sacrificing a little bit    Quite likely    Extremely important    Not at all difficult    8.151    66.801    68.44    7    19    21    0    83    73    22    78    72    11.737    36.077    38.099    16    A little bit intense    5.875    5.875    7.443    1    0    10    40    Quite useful    YES    42.267    71.834    73.025    8    At least 20 seconds    Soap can bust open the shell of the virus and destroy it    The virus gets into your body through mucous membranes    Sneeze into your elbow    6 feet    Visiting others at home for only short periods of time    Avoid getting other people sick    From several hours to a few days    When you are in public places that do not allow you to create social distance from others    20-30 times per hour    Go to the hospital immediately when you have a fever    Avoiding going places with substantial numbers of people around and staying at least 6 feet (or 2 meters) away from others    5.182    161.327    169.117    16    Slightly optimistic    Extremely important    Slightly knowledgable    Extremely useful    Slightly hopeful    Once in a while    Quite important    About a quarter    Slightly confident    Enjoy quite a bit    A little experience    Some    Enjoy quite a bit    28.266    85.707    86.453    14    91    88    94    They are being harmed right now    Quite worried    A great deal    12.556    37.809    38.745    9    With quite a bit precision    Extremely helpful    Extremely confident    Very certain    Very useful    A tremendous amount    Quite accurately    Completely credible    25.23    66.771    67.601    12    Female        45 - 54    30076    No    Yes    No    English    White/Caucasian                                Somewhat liberal    Completed graduate school    Graduated from High School    5    CNN news        5.886    61.476    72.572    16    3        0    0
        4/19/2020 9:52    4/19/2020 10:09    IP Address    75.164.249.85    100    1008    TRUE    4/19/2020 10:09    R_1f7YGrGNm2hGTcs                    45.5375061    -122.5988998    anonymous    EN    A1EH9BPKYXFBS5    Other    I read the instructions                                                                                                                                                                    0    0    42.476    0    6.784    6.784    186.548    1    12.465    12.465    86.578    1    0    0    22.222    0    123.021    123.021    131.845    1    A moderate amount of time    Will prioritize a great deal    Extremely closely    Extremely beneficial    Somewhat stressful    Sometimes    Extremely valuable    Quite a bit of effort    3.86    26.004    27.046    11    Slightly difficult    Extremely important    Extremely successfully    Sacrificing some    Not at all likely    Quite important    Quite diffciult    5.15    31.532    32.647    6    69    0    11    0    0    82    11    0    6.11    20.802    22.189    9    Not at all intense    11.97    11.97    15.515    1    0    0    50    Quite useful    NO    10.781    20.056    21.737    5    At least 20 seconds    Soap can bust open the shell of the virus and destroy it    The virus gets into your body through mucous membranes    Sneeze into your elbow    6 feet    Visiting others at home for only short periods of time    Avoid getting other people sick    From several hours to a few days    When you are in public places that do not allow you to create social distance from others    20-30 times per day    Go to the hospital immediately when you have a fever    Avoiding going places with substantial numbers of people around and staying at least 6 feet (or 2 meters) away from others    4.141    119.743    122.782    12    Somewhat optimistic    Extremely important    Slightly knowledgable    Quite useful    Extremely hopeful    Frequently    Extremely important    Almost none    Quite confident    Enjoy quite a bit    Some experience    Some    Enjoy a tremendous amount    19.14    67.723    68.818    14    100    93    100    They are being harmed right now    Extremely worried        7.536    25.176    34.574    3    With some precision    Quite helpful    Extremely confident    Extremely certain    Extremely useful    A tremendous amount    Extremely accurately    Completely credible    7.363    24.372    26.149    4    Female        45 - 54    97230    Yes    No    No    English    White/Caucasian                                Somewhat liberal    9th Grade    10th Grade    7    i liked the videos.        1.636    71.881    80.834    19    3        2    1
        4/19/2020 10:01    4/19/2020 10:09    IP Address    174.254.66.86    100    486    TRUE    4/19/2020 10:09    R_1o4HIM9dBPfvRT3                    37.75100708    -97.8219986    anonymous    EN    A18T7E73TNGOKP    Other    I read the instructions                                                                                    22.121    39.305    43.435    6    20.697    37.139    37.823    8    8.782    10.024    10.665    3    10.442    24.321    25.751    3    0.934    0.934    12.882    1                                                                                    A tremendous amount of time    Will prioritize some    Somewhat closely    Quite beneficial    Somewhat stressful    Sometimes    Moderately valuable    Quite a bit of effort    2.819    40.165    42.5    36    Slightly difficult    Moderately important    Somewhat successfully    Sacrificing a little bit    Not at all likely    Moderately important    Slightly difficult    0.953    13.878    14.639    32    10    3    3    63    66    20    22    81    0.601    14.952    15.551    24    Quite intense    2.257    3.296    4.136    3    50    0    0    Slightly useful    NO    2.67    28.299    29.298    23    At least 20 seconds    Soap removes dirt from your skin so that germs have nowhere to reside    The virus gets into your body through mucous membranes    Sneeze into your elbow    6 feet    Visiting others at home for only short periods of time    Avoid getting other people sick    From two days to three weeks    On high pollution days    20-30 times per hour    Wash your hands often with soap and running water    Reaching out to friends and family members who live far away and maybe suffering from loneliness or a lack of social contact    1.195    75.6    76.046    64    Quite optimistic    Not at all important    Slightly knowledgable    Slightly useful    Not at all hopeful    Almost never    Quite important    About a quarter    Somewhat confident    Enjoy a little bit    A little experience    Almost nothing    Enjoy a little bit    1.106    29.574    30.102    44    35    37    68    In 50 years    Not at all worried    A moderate amount    0.7    21.796    22.558    21    With some precision    Quite helpful    Not confident at all    Not certain at all    A tiny bit useful    Somewhat    A tiny bit accurately    Very credible    1.297    18.896    19.2    38    Male        35 - 44    4758    No    No    Yes    English    White/Caucasian                                Moderate    5th Grade    8th Grade    5    tv        0.755    39.902    42.784    45    3        1    0
        What do you think?
        Last edited by Petel Stvyrnksy; 28 Apr 2020, 15:31.

        Comment


        • #5
          Haha I just needed to stop being lazy and follow your advice. This code worked to fix it:
          Code:
          import delimited "C:\Users\clair\Desktop\Data Workflow & Linear Models_Sprin 2020\COVID-19 A_April 19, 2020_19.14 2.csv", delimiter(comma) bindquote(strict) varnames(4) stripquote(no) case(preserve) clear

          Comment

          Working...
          X