Announcement

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

  • Importing SAS data into Stata

    I am trying to import SAS data into STATA using import wizard in the menu but few of the columns are not getting imported (4 of these columns are character/string type and one is numeric). There are similar other variables type which are getting imported properly. When I copy the same columns separately into the partially imported SAS data then they get copied but importing the same is not working fully. Kindly suggest.

  • #2
    This is not an obvious problem.

    After the SAS dataset is imported, your log will show the command that was used and the number of observations and variables that were imported. Is the number of variables imported four fewer than the number of variables that you understood your SAS dataset to contain? If not, one possibility is that SAS has indeed imported the columns, but has found it necessary to change the variable names. Does a close look at your dataset reveal any variables that you don't recognize?

    What version of Stata are you running?
    Code:
    . about
    
    Stata/SE 16.1 for Mac (64-bit Intel)
    Revision 17 Sep 2020
    Copyright 1985-2019 StataCorp LLC

    Comment


    • #3
      Thanks William for the response. The command shows exactly the same variables that are there in the SAS dataset. However, in the variable list and (data in the STATA), few of these variables do not show up. I am using Stata 16.1. I checked importing only those variable from SAS data as well to check if something is skeptical, the command would show that variable is called but does not show up in the data/variable list in the STATA.
      Last edited by Saurabh Trivedi; 05 Oct 2020, 16:30.

      Comment


      • #4
        I know from other problems reported here that in Stata 16 changes were made "behind the scenes" to the code on which many of the import commands, including import SAS, is built. StataCorp was very responsive to those problem reports. I suggest you report this problem to Stata Technical Services and see what they have to say about it. They will likely want access to a copy of your SAS dataset to reproduce the problem in their environment.

        Please let us know what you learn from them. Good luck!

        Comment


        • #5
          Thanks William. As I am quite new to the forum and STATA itself, could you please let me know how can I report this issue with the relevant STATA team?

          Comment


          • #6
            The following can be found by successively
            • clicking on the link to www.stata.com at the beginning of your Stata Results window
            • clicking on Support at the top of the page that appears in your browser
            • clicking on Contact - underneath Technical Services - in the leftmost column of the dropdown window
            https://www.stata.com/support/tech-support/contact/

            Comment


            • #7
              Thank you so much

              Comment


              • #8
                Hello;

                I've encountered a problem about importing SAS file into STATA. I have SEER-CAHPS data and the datasets came with SAS input statements. I created a data dictionary for each dataset with text format but one of the datasets is SAS CPORT file with v9x extension. I tried to open it in R and Python but it seems that R and Python packages/modules only support XPORT files. Here is the SAS code from the National Cancer Institute website : https://healthcaredelivery.cancer.go...ort.survey.sas

                Any help would be grateful. Thanks.

                Comment


                • #9
                  If you have access to the Stat Transfer program, it will convert SAS CPORT datasets to Stata datasets.

                  https://stattransfer.com

                  Otherwise, perhaps you can have a colleague who has SAS use CIMPORT to read the dataset(s) and then write them as regular SAS datasets that can be read by Stata's import sas command.

                  Comment


                  • #10
                    Originally posted by Mehmet Sari View Post
                    I have SEER-CAHPS data and . . . one of the datasets is SAS CPORT file with v9x extension.
                    I think that Stata, like Python and R, cannot read SAS CPORT files. Stat/Transfer can.

                    I'd never heard of SEER-CAHPS, but apparently you had to jump through hoops (and then pay?) in order to get these data. Maybe, given that you or someone in your research group shelled out for these, the vendor will feel some twinge of guilt and break down to provide you the datasets again in a more universally readable file format.

                    Comment

                    Working...
                    X