Announcement

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

  • ASCI data to Stata format without a do-file

    Hey everyone!

    Would anyone be able to help me convert (or does anyone have the state file already) the CPS Contingent Work Supplement datasets for 1995, 1997, and 1999 from ASCII to .dta format?

    A link to the 1995 data can be found here: https://www.icpsr.umich.edu/icpsrweb/ICPSR/studies/6736.

    The ICPSR says you will need the codebook to reconstruct the syntax since they do not have the do file needed.

    Thank you!
    Jacob

  • #2
    Hi Jacob,

    So this is essentially a bump of the topic you started on 15 Nov 2018: CPS Contingent Work Supplement Conversion from ASCII to Stata format

    I would start with the NBER websites that I list down in item #4. If any of them contain the Stata .dta file and do file, that will be the fastest way to get things into Stata and going with analyzing the data:

    1. I suspect that the file is either TAB or Comma delimited. If that's the case type in -help input delimited- If you prefer to use Stata's dropdown menu, you can do File > Import > Text data (delimited, *csv) or File > Import > Text data in fixed format

    2. If there is a data dictionary file, you can do to File > Import > "Text data in fixed format with a dictionary"

    3. Stata mentions using infile, infix, or insheet here
    This might be a little dated because import has largely replaced Stata's insheet command. But the link has links to other places you might search for help.
    Most spreadsheet and statistical software packages are able to export data as ASCII text files containing fixed-format, free-format, comma-delimited, or tab-delimited data. If your package has this feature, you should be able to export the data, and then read the data into Stata using the infile (fixed format or free format), infix, or insheet command, depending on the file format. For information about infiling data and the method you should use, see [D] infiling.

    4. [*Start Here*]. NBER has Stata do files and data dictionary files for CPS datasets at Reading Current Population Survey (CPS) Data with SAS, SPSS, or Stata. The corresponding data files are available at NBER's CPS Supplements page. I don't know if either of those pages have the Contingent Work Supplement that you mention above.
    • They also have a page with several Stata do files that enable you to match consecutive March CPS surveys here.
    Last edited by David Benson; 18 Nov 2018, 22:26.

    Comment


    • #3
      In the prior topic, you asked:
      Originally posted by Jacob Judd View Post
      I contacted ICPSR and they said that it would be necessary to use the codebook to reconstruct the syntax. I'm not exactly sure what this means.
      I suspect it means that they won't be able to give you a data dictionary or do file to automatically code / label variables. Instead they will tell you in the codebook.
      Code:
      Family income (hufaminc) asked respondent to enter their family income into one of 16 categories:
      1     "Less than $5,000"
      2     "$5,000 TO 7,499"  
      3     "$7,500 TO 9,999"      
      ...
      ...
      15    "$100,000 TO 149,999"    
      16    "$150,000 OR MORE"
      
      Or that in a particular variable Yes=1, 2=No
      But that you would then need to code that manually into Stata as:
      Code:
      #delimit;  // turn semicolon into delimiter in your do file (rather than carriage return)
      label values hufaminc hufaminc;
      label define hufaminc
          1           "LESS THAN $5,000"                        
          2           "5,000 TO 7,499"                          
          3           "7,500 TO 9,999"                          
          4           "10,000 TO 12,499"                        
          5           "12,500 TO 14,999"                        
          6           "15,000 TO 19,999"                        
          7           "20,000 TO 24,999"                        
          8           "25,000 TO 29,999"                        
          9           "30,000 TO 34,999"                        
          10          "35,000 TO 39,999"                        
          11          "40,000 TO 49,999"                        
          12          "50,000 TO 59,999"                        
          13          "60,000 TO 74,999"                        
          14          "75,000 TO 99,999"                        
          15          "100,000 TO 149,999"                      
          16          "150,000 OR MORE"
      ;  
      
      #delimit cr  // make carriage return delimiter again
      Last edited by David Benson; 18 Nov 2018, 22:28.

      Comment


      • #4
        Got it! Thank you!

        Comment

        Working...
        X