BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
emaneman
Pyrite | Level 9

Dear all,

 

I am importing a .sav file (SPSS format) in SAS, and I am having some issues.

 

SAS imports the file smoothly (i.e., no errors or warnings), but categorical variables in SPSS are all labelled NUM (numerical variables) in SAS. For instance, a variable INCOME that includes values such as:

 

"less than $5,000"

"$15,000-19,999"

"$20,000-29,999"

...

 

is shown as type = NUM.

 

In fact, if I ask for a correlation (PROC CORR) between INCOME and another variable that contains only numbers, and it is clearly numerical, SAS computes it. 

But what is the meaning?

How does SAS turn the values of INCOME into numbers?

Is there a way to ask for that info? 

And additional issue is that if I use the values that SAS shows when I print a table with PROC FREQ  for the variable INCOME (e.g. "than $5,000") to compute a third variable, SAS does not recognize the values of INCOME. 

 

Thanks for any advice you may have.

 

Eman

 

 



1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

I suspect that the variables in the SPSS file were numeric with "value labels" attached.  Perhaps  Something like 1 means "less thatn $5000" and 2 means etc.

 

In SAS you use a FORMAT to tell SAS to display a value as something else.

 

If you want PROC IMPORT to convert those "value labels" into FORMATs then you need to tell it what format catalog to write the formats into.  And if you want SAS to be able to use the generated formats to display the numbers as that text then you need to tell SAS where to find those formats by setting the appropriate value of the FMTSEARCH system option.

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

I suspect that the variables in the SPSS file were numeric with "value labels" attached.  Perhaps  Something like 1 means "less thatn $5000" and 2 means etc.

 

In SAS you use a FORMAT to tell SAS to display a value as something else.

 

If you want PROC IMPORT to convert those "value labels" into FORMATs then you need to tell it what format catalog to write the formats into.  And if you want SAS to be able to use the generated formats to display the numbers as that text then you need to tell SAS where to find those formats by setting the appropriate value of the FMTSEARCH system option.

emaneman
Pyrite | Level 9
hello Tom,
thanks for the suggestion. I have resolved the import by adding

proc datasets;
modify SPSS;
format _all_;
quit;

Eman

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 655 views
  • 0 likes
  • 2 in conversation