Hello-
Looking for some assistance in putting together a new string variable. Due to bad data entry from various sources, I need to somehow make the data element consistent. Currently I have data sample #1- under column heading 'p_ds' there are dashes and spaces within the character string. I would like to create a new variable that would 1) eliminate the dash '-' in obs 1, 2 and 4. and 2) eliminate the space in position 3 and position 9 in obs 5.
obs | p_ds | count |
1 | 01-100017-6002000 | 5 |
2 | 01-611436090211 | 25 |
3 | 4159512368424 | 8 |
4 | 0461549-6003362 | 3 |
5 | 05 61564 6003420 | 8 |
I would like my final dataset to look like sample #2. How can I best approach this?
1 | 11000176002000 | 5 |
2 | 1611436090211 | 25 |
3 | 4159512368424 | 8 |
4 | 04615496003362 | 3 |
5 | 5615646003420 | 8 |
string=compress(p_ds,,'kd');
string=compress(p_ds,,'kd');
data want;
set have;
p_ds=compress(p_ds,,'kd');
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.