Hi all.
I am new to this forum.
I have encountered a problem working with the same data set in SPSS and Bluesky with automatic conversion of categorical/factor variables coded from 0.
eg The variable Dem_age is coded
0 16-34
1 -- 35+
I used dataset in Bluesky and save the it in bluesky it automatically recodes from 0=1, 1=2, etc. Also its converted from F1 to F8.1 and change variable level from nominal/ordinal tpo scale,
the same frequency command gives the following out put
This creates several problems in SPSS. Anyone know how to resolve this please?
Nkem
Hi Forcheh,
This problem arises because by default R stores factor levels internally as numerics starting from the number 1. Basically if you take any factor variable in R and convert it to a numeric, you will see that each level is represented by a unique number starting from 1 onwards. Typically when performing analysis in BlueSky Statistics, building models etc everything will work fine, however when saving back to SPSS, the mapping of the original factor level name to the corresponding numeric value in SPSS is lost. The reason is simple as once the SPSS dataset is open in R/BlueSky Statistics, it is converted to a R dataframe, the mapping between the original SPSS numeric values and the factor names are lost.
There was a feature we added that is marginally related to this problem. Just say you have a factor variable in R where the level names are numeric e.g. 10, 20, 30. If you convert a factor to a numeric in R, you would get 1,2,3 in place of 10, 20 and 30. This frustrated SPSS users using BlueSky Statistics, so we modifed the conversion from Factor to numeric in BlueSky Statistics (This is available in the right click menu see Make Numeric) to create a numeric with the original level names i.e. 10, 20, 30.
Now, its not impossible to get the round trip from SPSS and R and back to SPSS to work, we would need a way to save the original mapping in SPSS in attributes of the dataset, when we import it to R and then use these attributes when saving back to SPSS. This is a lot of work.
There may be easier ways, I will chat with a couple people and post if I find anything. Also, now that you know what is happening, and BlueSky Statistics and R you can manually adjust the values in SPSS after importing back from R for now