Raynald's SPSS Tools
  • Syntax
    • SPSS Syntax Home
    • Sample Syntax Library
    • Learning Syntax
    • Debugging SPSS Syntax
    • Standard Data Files
  • Macros
    • SPSS Macros — Home
    • Sample Macro Library
    • Learning Macros
    • Debugging Macros
    • Kirill's SPSS Macros Page
  • Scripts
    • SPSS Scripts — Home
    • Sample Scripts Library
    • Learning Scripts
    • The Asynchronous Problem
  • Python
    • Python Scripts Home
    • Sample Python Library
  • R
    • R Scripts — Home
    • Sample R Library
  • Resources
    • Resources Overview
    • Blog
    • Links to SPSS (and not only SPSS) resources
    • SPSS Programming and Data Management Book
  • Sitemap
  • Feedback
  • en
    • Русский
    • Español
    • Portugues
    • Deutsch
    • Français
    • Italiano
  1. Home
  2. Syntax
  3. Sample Syntax Library
  4. Transform variable

Transform variable

  • Constrain a Variable to a Given Interval Linear transformation of all variable values to fit within interval of 2 values. Basic solution and generalizations with macros.
  • Convert Numbers to String with Leading Zeros Syntax creates string of fixed width from number (like, say, post code). Unused number positions are filled with zeros
  • Create Variable Equal to z-scores of an Existing Variable Syntax shows how to save standardized copy of a variable through DESCRIPTIVES procedure.
  • Extract Fist or First 2 Digits of a Large Integer Number of digits to extract depends on the length of the original number. Elegant solution via logarithm
  • Global Autorecode How to automatically assign codes to variable values with common coding per variable group
  • Replace a Letter to 9999 and Convert to Number Replacing some letter to a string representation of a number and subsequent conversion to a number variable
  • Replace Confidential Information (e.g. a SSN) by a New (Known) ID This syntax matches file with SSN-ID keys to the file with SSN personal data. Sensitive information is removed from the resulting file aftewards.
  • Replace Values Higher than ``n`` by the Mean of the Other Values 1 First, mean statistic is calculated by AGGREGATE on conditioned sample. Then mean is matched with original file, replacing higher values.
  • Automatically Rescale Variable to be Between 0 and 1 Example of a macro to rescale any variable within given bounds
  • Transform Alphanumeric Codes to Numeric Transformation of string codes to numeric
  • Examples of Converting Strings To Numbers Several examles of conversion strings to numbers using different string types
  • Calculate utility of EuroQol 5D questionnaire Calculated Utility of EuroQol 5D
Related pages

...

Navigate from here
  • Sample Syntax Library
  • Strings
  • Tutorials
  • Constrain a Variable to a Given Interval
  • Get random page
  • Back to top

 


 

Raynald's SPSS Tools © 2001–2025, Raynald Levesque, Anton Balabanov. Click to learn more: About the project