Search code examples
importsaslabelspss

Import SPSS data into SAS without Labels and Values


As I am new to SAS I am having trouble to import spss data into sas using the "proc import" command. The code I was using:

proc import datafile = "C:\Users\spss.sav"
 out=work.test
 dbms = sav
 replace;
 run;

The main problem is that when imported to sas, the datatable variables have the values and not the coding. So for instance if the variable "Gender" is coded 1=male 2=female, each observation in sas has "female" or "male".

Now according to here:

Proc Import from SPSS

if the following code is added after the code above, then this problem ceases to exist:

proc datasets;
modify my_dataset;
format _all_;
quit;

What still remains is that the Variable names from spss, instead of having their name, when imported to sas they have the labels that are assigned in spss. Is there any command that can keep the Names of the variables in SAS, instead of the SPSS labels?


Solution

  • It's possible that you are seeing column labels but that the underlying names still exist. You can modify your datasets procedure to remove the labels as well as the formats. Try this after your proc import:

    proc datasets library = work;
        modify test;
        attrib _ALL_ label = " " format =;
    run;
    

    The attrib statement is applying a blank label and format to every variable.