Announcement

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

  • How to merge datasets from SAS Plus (dat-files) in Stata?

    Hi.

    How do I merge datasets from SAS Plus (dat-files) in Stata?

    Here is the data files: Data in SAS transport files ("cfldtrns.zip", 2.2MB)

    Thank you.

  • #2
    Do you mean how to import these? Files have .dat extension but dont seem readable by Stata. Stata does have a import option for SAS files but seems to expect .xpt extension. Never done this before myself but seems the export didn't go as wanted.

    Comment


    • #3
      Originally posted by Fredrik Grondahl View Post
      How do I merge datasets from SAS Plus (dat-files) in Stata?

      Here is the data files: Data in SAS transport files ("cfldtrns.zip", 2.2MB)
      Well, you'd copy the zip file to your (current) working directory (help pwd), then do something like the following to inspect what the variables are to merge on for each of the files, and then go from there.
      Code:
      unzipfile cfldtrns.zip, replace
      local files : dir "." files "*.dat"
      foreach file of local files {
          import sasxport `file', clear
          describe
      }
      I've heard of S-Plus, but not SAS Plus. The files in your zip file are indeed SAS Version 5 transport files, although, as Jorrit mentions, the file extension is .dat instead of the traditional .xpt, but you can override the default extension by explicitly declaring the full file name, as in the code shown above.

      Comment

      Working...
      X