BookmarkSubscribeRSS Feed
RV4
Calcite | Level 5 RV4
Calcite | Level 5
data EMWS1.datosreg;
set &EM_IMPORT_DATA;
estadoCivilNew = estadoCivil;
if estadoCivil = 'CASADO C/SEPARACIÓN DE BIENES' then estadoCivilNew = 1;
else if estadoCivil = 'CASADO CON GANANCIA' then estadoCivilNew = 2;
else if estadoCivil = 'CASADO S/SEPARACIÓN DE BIENES' then estadoCivilNew = 3;
else if estadoCivil = 'SOLTERO' then estadoCivilNew = 4;
else if estadoCivil = 'VIUDO' then estadoCivilNew = 5;
else if estadoCivil = 'SEPARADO' then estadoCivilNew = 6;
else if estadoCivil = 'DIVORCIADO (A)' then estadoCivilNew = 7;
else estadoCivilNew = 8;

estudiosNew = estudios;
if estudios = 'UNIVERSITARIA' then estudiosNew = 1;
if estudios = 'SECUNDARIA' then estudiosNew = 2;
if estudios = 'PRIMARIA' then estudiosNew = 3;
if estudios = 'No Informado' then estudiosNew = 4;
else estudiosNew = 5;

tipopropiedadNew = tipoPropiedad;
if tipoPropiedad = 'PROPIA CON DEUDA' then tipopropiedadNew = 1;
else if tipoPropiedad = 'PROPIA SIN DEUDA' then tipopropiedadNew = 2;
else if tipoPropiedad = 'DE UN FAMILIAR' then tipopropiedadNew = 3;
else if tipoPropiedad = 'ARRENDADA' then tipopropiedadNew = 4;
else if tipoPropiedad = 'EMPLEADOR' then tipopropiedadNew = 5;
else if tipoPropiedad = 'No Informado' then tipopropiedadNew = 6;
else if tipoPropiedad = 'FISCAL' then tipopropiedadNew = 7;
else tipopropiedadNew = 8;


run;

Hi all

 

Got a question (quite new to SAS Miner). I have a nominal variable in SAS which is basically the marital status: (married, single, divorced etc.) -> I would like to do a logistic regression and therefore have to transform the variable into a Interval variable. So what I did is following:

 

data EMWS1.datosreg;
set &EM_IMPORT_DATA;
estadoCivilNew = estadoCivil;
if estadoCivil = 'married' then estadoCivilNew = 1;
else if estadoCivil = 'single' then estadoCivilNew = 2;
else estadoCivilNew = 3;

However my new variable "estadoCivilNew" is still considered nominal, or anything else but interval. Anyone knows how to tackle my problem maybe in an easier way?

 

Thank you very much & best regards

sas_problem.png

1 REPLY 1
Reeza
Super User

Hi @RV4 welcome to the SAS Community forums.

 

I've modified your subject line and moved your post to a better location. Posting it at the end of someone else's solved questions means it's unlikely to be seen at all. 

 

If you're searching documentation/google you can look for 'how to change a variable role in SAS EM' to find options. A good place to check is lexjansen.com. 

 

One other method - recode your variables using the recode task, not a code node and see if lets you change it there while creating the new variable.

 

Otherwise, hopefully you get a response soon. 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 2506 views
  • 0 likes
  • 2 in conversation