I have column cust has character type and I want to change the type to numeric of the same variable.
data one;
set wes;
cust = input ( cust,best8.) ;
run;
But still, in the output, I am seeing the type of cust as a character which I am expecting to be numeric.
To change column type you have to assign it to a different column:\
data one;
set wes (rename = (cust = cust_char));
cust = input ( cust_char, best8.) ;
run;
Or even:
data one (drop = CUST_CHAR);
set WES (rename = (CUST = CUST_CHAR) );
CUST = input ( CUST_CHAR, best8.) ;
run;
> But still, in the output, I am seeing the type of cust as a character which I am expecting to be numeric.
Look at the log. Look at the log. Look at the log. Look at the log. Look at the log.
Always look at the log. Even if there are (you think) no errors.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.