Hello,

I am trying to add text responses to an existing variable.

I have a variable Q33_20_TEXT that comprises of text responses to "Other (please specify __________________) "

Code:
Q33_20_TEXT                                                              Industry Other please specify
------------------------------------------------------------------------------------------------------

                  type:  string (strL)

         unique values:  4                        missing "":  171/175

            tabulation:  Freq.  Value
                           171  ""
                             1  "Environment and Conservation"
                             1  "Philanthropic Organization/Foundation"
                             1  "land conservation trust"
                             1  "non-profit"

               warning:  variable has embedded blanks
I would like to recode these variables to categories in variable "Industry"

Code:
. codebook Industry

------------------------------------------------------------------------------------------------------
Industry                                                                           Combines Q6 and Q33
------------------------------------------------------------------------------------------------------

                  type:  numeric (float)
                 label:  Industry

                 range:  [1,20]                       units:  1
         unique values:  14                       missing .:  114/175

              examples:  10    Manufacturing
                         .    
 
. labelbook Industry

------------------------------------------------------------------------------------------------------
value label Industry
------------------------------------------------------------------------------------------------------

      values                                    labels
       range:  [1,20]                    string length:  [6,81]
           N:  20                unique at full length:  yes
        gaps:  no                  unique at length 12:  yes
  missing .*:  0                           null string:  no
                               leading/trailing blanks:  yes
                                    numeric -> numeric:  no
  definition
           1   Accommodation & Food Services
           2   Administrative & Support & Waste Management & Remediation Services
           3   Arts, Entertainment and Recreation
           4   Construction
           5   Educational Services
           6   Finance and Insurance
           7   Health Care and Social Assistance
           8   Information (i.e., publishing [except internet], motion picture and sound, broa
           9   Management of Companies and Enterprises
          10   Manufacturing
          11   Mining, Quarrying, and Oil and Gas Extraction
          12   Other Services (except Public Administration)
          13   Professional, Scientific, and Technical Services
          14   Real Estate and Rental and Leasing
          15   Retail Trade
          16   Transportation and Warehousing
          17   Utilities
          18   Wholesale Trade
          19   Agriculture, Forestry, Fishing and Hunting
          20   Other

   variables:  StartDate Industry
For example, I'd like to move Q33_20_TEXT= "non-profit" to the "20 - Other" category in Industry.

When I try to do this using the "replace command", it doesn't work
Code:
. replace Industry = 20 if Q33_20_TEXT=="non-profit"
(0 real changes made)
I tried trimming the blanks from the right end of the variable and from both ends of the variable. However, this still hasn't worked:

Code:
 replace Q33_20_TEXT =strrtrim( Q33_20_TEXT)
(171 real changes made)

. replace Industry = 20 if Q33_20_TEXT=="non-proift"
(0 real changes made)


. replace Q33_20_TEXT =strtrim(Q33_20_TEXT)
(0 real changes made)

. replace Industry = 20 if Q33_20_TEXT=="non-profit"
(0 real changes made)
I would be very grateful for any advice on what to do. Many thanks, Sarah