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
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.
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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.