Subscribe Bookmark RSS Feed

Simple Noob Data Recoding Question...

I know this should be easy but I am spinning trying to figure it out.

I have a character column that has values 1,2,3,4,5,6,7,8 and then in this same column the remaining data is all over the place, such as "asxd", "Bfghe", Lmnhrt", etc.,

What would be the best way to leave the 1-8 range alone and recode the remaining values to 9?

There are 1,000's of different values other than the 1-8 that I already recoded by hand.

Thanks for the pointers...
BB
2 REPLIES
mpb

Super User

Joined:

Jun 23, 2011

At first I tried to finesse the Recode function to get something that was easy to modify and maybe that can be done. But I found it easier for your specific case to do the following:
1. Create a new column with an appropriate name
2. In that new column enter the following formula (assuming the column to be recoded is called "Y" and that there are only 4 existing recoded values):


That would work on the originally unrecoded data. If you have a column where all the 8 (4 here) values exist as recoded values then change the second of each pair to :Y. e.g. for "One" (or whatever you recoded to) use :Y (no quotes).
ms

Super User

Joined:

Jun 23, 2011

One quick way is to temporarily change to "Numeric" which leaves all strings as missing values. Then select all empty rows and any rows >8 (row selection/select where... in the rows menu) and then paste 9. Revert back to "Character".

Another thing I just discovered is that pasting of multiple entries is possible in the recode dialog. However it may be impractical in this particular case with thousands of different levels since the rows must still be selected by hand (select all does not work).