Stata Version 14



Version

VersionStata version 14.2

Stata Download Free

    • Aug 2020
    • 6

    Equivalence of Stata version 12 and version 14

    Hello:
    I am trying to import .txt data from the Single Family Loan-Level Dataset http://www.freddiemac.com/fmac-resou...user_guide.pdf
    The code to import data provided in the user guide (page 31) is:
    insheet using <data_filename>, delimiter(“|”)
    Note: The above-mentioned steps have been tested and suggested only for STATA Ver. 12.
    I am using Stata version 14 and my code is:
    import delimited using <data_filename>.txt, delim('|') varnames(1) clear
    However, the imported data does not have the variable name (on the first row).
    I would like to have the equivalent code for Stata version 14 and the output should include variable name.
    Can anyone help?
    Thanks,
    Ben Lee
    Below include the .txt sample data:
    F118Q3000001|201809|150000|0|0|360|||||4.75|0||||| |||||||||||
    F118Q3000001|201810|150000|0|1|359|||||4.75|0||||| |||||||||||
    F118Q3000001|201811|149000|0|2|358|||||4.75|0||||| |||||||||||
    F118Q3000001|201812|149000|0|3|357|||||4.75|0||||| |||||||||||
    F118Q3000001|201901|149000|0|4|356|||||4.75|0||||| |||||||||||
    F118Q3000001|201902|149000|0|5|355|||||4.75|0||||| |||||||||||
    F118Q3000001|201903|149000|0|6|354|||||4.75|0||||| |||||||||||
    F118Q3000001|201904|148358.33|0|7|353|||||4.75|0|| ||||||||||||||
    F118Q3000001|201905|148163.11|0|8|352|||||4.75|0|| ||||||||||||||
    F118Q3000001|201906|147967.12|0|9|351|||||4.75|0|| |||||||||0|||44.7||
    F118Q3000002|201809|337000|0|0|360|||||5|0|||||||| ||||||||
    F118Q3000002|201810|336000|0|1|359|||||5|0|||||||| ||||||66||
    F118Q3000002|201811|336000|0|2|358|||||5|0|||||||| ||||||66.1||
    F118Q3000002|201812|335000|0|3|357|||||5|0|||||||| ||||||66||
    F118Q3000002|201901|334000|0|4|356|||||5|0|||||||| ||||||65.7||
    F118Q3000002|201902|333000|0|5|355|||||5|0|||||||| ||||||64.6||
    F118Q3000002|201903|332000|0|6|354|||||5|0|||||||| ||||||63||
    F118Q3000002|201904|331265.99|0|7|353|||||5|0||||| |||||||||63||
    F118Q3000002|201905|329523.95|0|8|352|||||5|0||||| |||||||||62.2||
    F118Q3000002|201906|329523.95|0|9|351|||||5|0||||| ||||||0|||62.4||
    F118Q3000003|201808|453000|0|0|180|||||4.625|0|||| ||||||||||35.7||
    F118Q3000003|201809|451000|0|1|179|||||4.625|0|||| ||||||||||35.1||
    F118Q3000003|201810|450000|0|2|178|||||4.625|0|||| ||||||||||35||
    F118Q3000003|201811|448000|0|3|177|||||4.625|0|||| ||||||||||34.3||
    F118Q3000003|201812|446000|0|4|176|||||4.625|0|||| ||||||||||34.9||
    F118Q3000003|201901|444000|0|5|175|||||4.625|0|||| ||||||||||34.6||
    F118Q3000003|201902|443000|0|6|174|||||4.625|0|||| ||||||||||33.7||
    F118Q3000003|201903|440715.39|0|7|173|||||4.625|0| |||||||||||||33.2||
    F118Q3000003|201904|438918.78|0|8|172|||||4.625|0| |||||||||||||33.1||
    F118Q3000003|201905|437115.25|0|9|171|||||4.625|0| |||||||||||||33||
    F118Q3000003|201906|435304.77|0|10|170|||||4.625|0 |||||||||||0|||32.6||
    • Mar 2014
    • 23392
    varnames(nonames) would seem to be the option you need if the variable names do not appear in the first row of the data file. But you don't need to specify varnames() at all if there are no variable names in the dataset. I tried your file in Stata 16.1 and it produced a dataset with variable names v1 to v28.
    I don't have access right now to Stata 14 but my understanding from https://www.stata.com/manuals14/dimportdelimited.pdf is that this was true in 14 too.

    Comment

    • Apr 2014
    • 19194
    Well, the text example you show contains no variable names. If there are no variable names in the text file, you can't expect Stata to guess what they are supposed to be, and the -varnames(1)- option will just serve to omit the data in your first observation, changing those values to variable names where possible, and losing the information altogether where it isn't possible.
    If your actual text file does contain variable names in its first row, you should post it with that included. It is hard to see why the command -import delimited using <data_filename>.txt, delim('|') varnames(1) clear- would not lead to a result that includes the variable names. But nobody can even troubleshoot it without the correct text file information.
    Added: Crossed with #2.

    Comment

    • Aug 2020
    • 6
    Thanks you for your response. I ran the sas code provided by the user guide (please find the attached) and received the output including 2 files: originate file and performance file (the excel files attached). The problem with the SAS is there are a lot of missing information such as FICO, ID_loan in the output file (originate file). I am not quire sure why there are variable names in the SAS outputs, but there is no variable name in Stata output.
    Any help is appreciated.
    Attached Files

    Comment

    • Apr 2014
    • 19194
    Well, I don't download attachments from people I don't know, especially not Microsoft Office documents which can contain malicious active content.
    And you are only showing the output you got from SAS, not the input. The question is what is in the input file. If it really looks like what you showed in #1, it doesn't contain variable names, and there is no way that -import delimited- can guess what they should be.
    I suspect that if you look at the SAS code that produces output with variable names, the variable names are actually spelled out in the SAS code itself. If I am right about that, then what you must do is run -import delimited- in Stata without the -varnames- option. You will get default variable names instead, like var1 or v1, etc. Then you will have to run a series of -rename- commands to change those to the names you want. You will find those names in the SAS code.

    Comment

    • Aug 2020
    • 6
    The SAS code is here:
    data origfileQ12018;
    infile 'C:Real_estatesample_2018.txt' dlm= '|' MISSOVER DSD lrecl=32767 firstobs=1 ;
    input
    fico : 8.
    dt_first_pi : 8.
    flag_fthb : $1.
    dt_matr : 8.
    cd_msa : 8.
    mi_pct : 8.
    cnt_units : 8.
    occpy_sts : $1.
    cltv : 8.
    dti : 8.
    orig_upb : 8.
    ltv : 8.
    int_rt : 8.
    channel : $1.
    ppmt_pnlty : $1.
    prod_type : $5.
    st : $2.
    prop_type : $2.
    zipcode : $5.
    ID_loan : $12.
    loan_purpose : $5.
    orig_loan_term : 8.
    cnt_borr : $2.
    seller_name : $60.
    servicer_name : $60.
    flag_sc : $1. ;
    run;
    data svcgfileQ12018;
    infile 'C:Real_estatesample_2018.txt' dlm= '|' MISSOVER DSD lrecl=32767 firstobs=1 ;
    input
    ID_loan : $12.
    Period : 8.
    Act_endg_upb : 8.
    delq_sts : $8.
    loan_age : 8.
    mths_remng : 8.
    repch_flag : $1.
    flag_mod : $1.
    CD_Zero_BAL : $3.
    Dt_zero_BAL : 8.
    New_Int_rt : 8.
    Amt_Non_Int_Brng_Upb : 12.
    Dt_Lst_Pi : 6.
    MI_Recoveries : 12.
    Net_Sale_Proceeds : $14.
    Non_MI_Recoveries : 12.
    Expenses : 12.
    legal_costs : 12.
    maint_preserv_costs : 12.
    Taxes_ins_costs : 12.
    misc_costs : 12.
    actual_loss : 12.
    Modcost : 12.
    Stepmod_ind : $1.
    dpm_ind : $1.
    eltv : 12.1
    zb_removal_upb : 12.
    dlq_acrd_int : 12.;
    run;
    The data input is the .txt
    F118Q3000001|201809|150000|0|0|360|||||4.75|0||||| |||||||||||
    F118Q3000001|201810|150000|0|1|359|||||4.75|0||||| |||||||||||
    F118Q3000001|201811|149000|0|2|358|||||4.75|0||||| |||||||||||
    F118Q3000001|201812|149000|0|3|357|||||4.75|0||||| |||||||||||
    F118Q3000001|201901|149000|0|4|356|||||4.75|0||||| |||||||||||
    F118Q3000001|201902|149000|0|5|355|||||4.75|0||||| |||||||||||
    F118Q3000001|201903|149000|0|6|354|||||4.75|0||||| |||||||||||
    F118Q3000001|201904|148358.33|0|7|353|||||4.75|0|| ||||||||||||||
    F118Q3000001|201905|148163.11|0|8|352|||||4.75|0|| ||||||||||||||
    F118Q3000001|201906|147967.12|0|9|351|||||4.75|0|| |||||||||0|||44.7||
    F118Q3000002|201809|337000|0|0|360|||||5|0|||||||| ||||||||
    F118Q3000002|201810|336000|0|1|359|||||5|0|||||||| ||||||66||
    F118Q3000002|201811|336000|0|2|358|||||5|0|||||||| ||||||66.1||
    F118Q3000002|201812|335000|0|3|357|||||5|0|||||||| ||||||66||
    F118Q3000002|201901|334000|0|4|356|||||5|0|||||||| ||||||65.7||
    F118Q3000002|201902|333000|0|5|355|||||5|0|||||||| ||||||64.6||
    F118Q3000002|201903|332000|0|6|354|||||5|0|||||||| ||||||63||
    F118Q3000002|201904|331265.99|0|7|353|||||5|0||||| |||||||||63||
    F118Q3000002|201905|329523.95|0|8|352|||||5|0||||| |||||||||62.2||
    F118Q3000002|201906|329523.95|0|9|351|||||5|0||||| ||||||0|||62.4||
    F118Q3000003|201808|453000|0|0|180|||||4.625|0|||| ||||||||||35.7||
    F118Q3000003|201809|451000|0|1|179|||||4.625|0|||| ||||||||||35.1||
    F118Q3000003|201810|450000|0|2|178|||||4.625|0|||| ||||||||||35||
    F118Q3000003|201811|448000|0|3|177|||||4.625|0|||| ||||||||||34.3||
    F118Q3000003|201812|446000|0|4|176|||||4.625|0|||| ||||||||||34.9||
    F118Q3000003|201901|444000|0|5|175|||||4.625|0|||| ||||||||||34.6||
    F118Q3000003|201902|443000|0|6|174|||||4.625|0|||| ||||||||||33.7||
    F118Q3000003|201903|440715.39|0|7|173|||||4.625|0| |||||||||||||33.2||
    F118Q3000003|201904|438918.78|0|8|172|||||4.625|0| |||||||||||||33.1||
    F118Q3000003|201905|437115.25|0|9|171|||||4.625|0| |||||||||||||33||
    F118Q3000003|201906|435304.77|0|10|170|||||4.625|0 |||||||||||0|||32.6||
    The output of the originate file includes the variable names:
    ficodt_first_piflag_fthbdt_matrcd_msami_pctcnt_unitsoccpy_stscltvdtiorig_upbltvint_rtchannelppmt_pnltyprod_typestprop_typezipcodeid_loanloan_purposeorig_loan_termcnt_borrseller_nameservicer_nameflag_sc

    Comment

    • Apr 2014
    • 19194
    So, yes, you can see that the SAS input command gives the variable names. So you will have to write out code to rename the variables after you bring in the data itself with -import delimited-.
    Last edited by Clyde Schechter; 15 Sep 2020, 13:45.

    Comment

Stata Version 14Stata free download for windows

Stata Version 14 Free Download

Jupyter with a Stata Kernel¶ Kyle Barron has created a statakernel that offers several useful features including code-autocompletion, inline graphics, and generally fast responses. For this to work you must have a working licensed copy of Stata version 14 or greater on your machine. The original file is saved in Stata 13 or 14, so the read.dta command does not work. I also tried read.dta13 and it reads it sometimes but it cuts off the database at a certain spot and does not give me all the variables contained in the data set (which I can see and work with perfectly on Stata). Stata is a complete, integrated statistical software package that provides everything you need for data analysis, data management, and graphics. Stata is not sold in pieces, which means you get everything you need in one package.