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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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