f



PROC CONVERT spss. Too long variable names from SPSS to SAS

Hallo

I need to import a spss data file into SAS. I works just fine except
from the the spss variable names being longer than eight characters
and are thus renamed to a length of eight in SAS.

Does anybody know how I can circumvent this problem? I need variable
names of at least length 25 characters. By the way I'm using SAS 9.1!

This is my code:

filename myfile 'C:\bank\test.por';
proc convert spss=myfile out=work.vv;
run;

Thanks

Anders
Norway
0
anderj (1)
12/1/2004 2:52:01 PM
comp.soft-sys.sas 142827 articles. 4 followers. Post Follow

2 Replies
936 Views

Similar Articles

[PageSpeed] 46

Why use proc convert?

The following will read in a SAS file (okay, so I did it for a SAS .xpt
file, but I think it will work on all SAS files? )

libname xxx spss 'C:\Projects\rawdata\spssfile1.por';           *FULL
filename;
libname anal 'C:\Projects\analysis_datasets';                   *folder
location where data will be stored;
Data anal.sasfile1;             *saves file (named sasfile1) in SAS format
in location defined above;
        set xxx.data;           *sets file from SPSS into that file;

HTH!
Venita

> ----------
> From:         Anders J[SMTP:anderj@STUD.NTNU.NO]
> Reply To:     Anders J
> Sent:         Wednesday, December 01, 2004 9:52 AM
> To:   SAS-L@LISTSERV.UGA.EDU
> Subject:      PROC CONVERT spss. Too long variable names from SPSS to SAS
>
> Hallo
>
> I need to import a spss data file into SAS. I works just fine except
> from the the spss variable names being longer than eight characters
> and are thus renamed to a length of eight in SAS.
>
> Does anybody know how I can circumvent this problem? I need variable
> names of at least length 25 characters. By the way I'm using SAS 9.1!
>
> This is my code:
>
> filename myfile 'C:\bank\test.por';
> proc convert spss=myfile out=work.vv;
> run;
>
> Thanks
>
> Anders
> Norway
>
0
depuy001 (330)
12/1/2004 3:08:45 PM
Anders,
I have also had the same problem converting SPSS to SAS with the
variable names being truncated. The only solution I could find is by
renaming the variables manually to names 8 characters long, then
importing it and renaming it into SAS. I believe that SPSS
automatically truncates the variable names to 8 characters when
creating portable files, its something to check out and thats where the
problem is.

Also, you should make sure your SPSS datafile does not have any 'user
defined' missing values (e.g. -1=N/A) as SAS will read all missing
values as system missing "." and you will lose those definitions. Hope
this helps.

Neerav

0
12/1/2004 4:01:05 PM
Reply: