SAS Life Science Analytics Framework and the clinical data products from SAS

Convert SPSS files into SAS V9 datasets in SDD 3.5?

Reply
SAS Employee
Posts: 1

Convert SPSS files into SAS V9 datasets in SDD 3.5?

You can convert SPSS into SAS V9 dataset using PROC IMPORT and DBMS = SAV option. From Process Editor you can write a sas program to do remote signon to SDD PC File Server and convert the SPSS file into SAS dataset. Here is the example code,


libname sddlib "&liblocation";

      %*************************************************************************
      %* Declare WebDAV fileref for SAV data set
      %************************************************************************;
      filename SD2File sasxbamw "https://sddyourinstance.sas.com/webdav/sdd/test/demo.sav"
               user="&sddusr"
               password="&sddpw";

      signon inheritlib=(sddlib);   

      %*************************************************************************
      %* Transfer local macro variables to the SAS PC server
      %************************************************************************;
  %syslput sd2file=demo.sav;
  %syslput sd2dset=demo.sas7bdat;
 
      rsubmit;

         %**********************************************************************
         %* Set the SAS PC location for the SAV file to the WORK directory --
         %*    this will let the file to be recognized as a SAS data set
         %*********************************************************************;
         data _null_;
            cmd_str="filename outsd2 '"
                 || pathname("work")
                 || "\&sd2file';";
    put cmd_str=;      
            call execute(cmd_str);
         run;

         libname test 'C:\Temp';  
  
         %**********************************************************************
         %* Upload the SAV data set as DATA.sav in the TEST librarys directory
   %*  on the SAS PC server
         %*********************************************************************;
         proc upload infile =SD2File
                     outfile="C:\TEMP\data.sav"
                     binary
                     connectstatus=no;

         %**********************************************************************
         %* Download the data set from TEST on the SAS PC server to the SDD
         %*    library where it originated.  Downloading it as a data set will
         %*    convert it from SPSS to SAS V9 dataset 
         %*********************************************************************;

proc import
datafile="C:\TEMP\data.sav"
out=sddlib.&sd2dset
dbms=sav
replace;
run;

  
      %*************************************************************************
      %* close out the remote session
      %************************************************************************;
      endrsubmit;
      signoff;

      data sddlib.demo;
        set sddlib.demo;
      run;

Ask a Question
Discussion stats
  • 0 replies
  • 244 views
  • 0 likes
  • 1 in conversation