Hi,
How can I delete fist zero in variable ID_var it is charecter variable.
This is i have
IDD | PL | ID_var |
1233964 | 30998 | 0000000010000100 |
1234531 | 32331 | 0000000010006377 |
1237805 | 39791 | 0000000010042044 |
140434 | 41328 | 0000000010049190 |
This I want
IDD | PL | ID_var |
1233964 | 30998 | 10000100 |
1234531 | 32331 | 10006377 |
1237805 | 39791 | 10042044 |
140434 | 41328 | 10049190 |
Does anybody know?
data test;
id_var = "0000000010000100";
id_var = left(put(input(id_var,32.),best32.));
run;
data test;
id_var = "0000000010000100";
id_var = left(put(input(id_var,32.),best32.));
run;
Try this:
data test;
length id_var $32;
input id_var;
id_var = strip(put(input(id_var,32.),32.));
datalines;
0000000010000100
0000000010006377
0000000010042044
0000000010049190
;
run;
I would like to change it to numeric variable without datalines statement.
data want;
set have (rename=(id_var=id_char));
id_var = input(id_char,32.);
drop id_char;
run;
there are multiple solutions in the below thread
https://communities.sas.com/t5/Base-SAS-Programming/Function-to-remove-leading-zeros/td-p/61537
I would like to change it to numeric variable...is there any option?
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.