Hi
Is it possible to import a *.sav file into SAS without also getting labels/formats that is defined in SPSS?
Thanks in advance,
Kristoffer
I don't know how to use proc import to eliminate labels and format.
But you can erase them after importing SAS.
data class; set sashelp.class; label sex='gender'; format weight dollar12.; run; proc datasets library=work nolist; modify class; attrib _all_ label=' ' format=; quit;
Ksharp
I don't know how to use proc import to eliminate labels and format.
But you can erase them after importing SAS.
data class; set sashelp.class; label sex='gender'; format weight dollar12.; run; proc datasets library=work nolist; modify class; attrib _all_ label=' ' format=; quit;
Ksharp
Thanks for your help. Thats convenient enough. Cheers
Does anyone know how to keep the SPSS formats after importing the SPSS .sav file and then storing as SAS dataset in a permanent library? In other words, after saving as a SAS dataset I can not open the file unless I remove all the labels and formats the code mentioned in this post.
If you are getting an error related to unavailable formats try
options nofmterr;
the SAS option FMTERR / NOFMTERR determines whether an undefined format is an error or not. If the FMTERR is set then you can't open data sets that have such formats (or run PROC FREQ or do much of anything else.)
Thanks. This auto copied the formats folder to the permanent library but still getting "ERROR: can open the table DS.dataset. I am using SAS 9.2 x64 on MS 2003 Terminal Server. Also, this only occurs if I close the SAS program I used to import the SPSS file and then open a different SAS file.
Thanks. This is difinitely useful info. So you can't import a SPSS file with formats and labels and then create a SAS dataset with these formats and labels very easily? My goal is to keep the dataset with formats and labels associated with the original SPSS file as a SAS dataset. I usually don't have issues with giving SPSS users SAS datasets because SPSS doesn't have problems importing SAS datasets.
In SPSS the formats (?data labels?) are stored in the same file as the data. In SAS only the NAME of the format is stored with the data. So you will need to add additional steps to both save the formats where you want them and for the users to use to make sure they can find the formats when they use the data.
You could instead generate code to save the formatted values as new variables in the data.
proc sql noprint ;
select name,cats(name,'_decode')
into :name separated by ' '
, :decode separated by ' '
from dictionary.columns
where libname='SASHELP'
and memname='CLASS'
;
quit;
data new;
set sashelp.class;
array _decode $200 &decode ;
do _n_=1 to dim(_decode);
_decode(_n_)=vvaluex(scan("&name",_n_,' '));
end;
run;
I search it at this site. You can find a lot of resource about it.
https://communities.sas.com/message/7278#7278
http://www.psych.yorku.ca/lab/sas/spss2sas.htm
Ksharp
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: