08-11-2011 11:11 PM
My original SPSS data can be viewed in both numeric and character values, i.e.
1 = Yes; 0 = No; In SPSS, you can either view them in numeric or character format.
When I imported the SPSS data to SAS, the data retains SPSS's character value appearance, but with numeric type.
So I was wondering whether I can convert them to actual character type, and work on those character value.
appears in SAS data, but their true type is numeric, which are 1 1 0 0.
How can I keep them as character value as (Yes No) when they are imported to SAS ?
Thanks and Regards
08-11-2011 11:24 PM
As noticed in SAS, when imported SPSS file, it also create a "formats" sub-directory, which contains all the format of the variables, telling 1 = Yes, 0 = No.
Then the question now will be that how to let character formats as the actual character values rather than numeric ?
08-14-2011 11:28 AM
I may not understand what you are trying to accomplish, but it sounds like you simply want a copy of the file as it would be created by proc sql. Does the following mimic what you are trying to do?:
/* Create format and build test file with formats */
format sex $gender.;
format age agegroup.;
/* Create a copy of file with formatted values */
proc sql noprint;
create table want as
put(sex,$gender.) format=$6. AS sex,
put(age,agegroup.) format=$5. AS age,