Hi,
The indentified variable is currently listed as character $500. How can I shorten the length to $8 and add leading zeros to those numbers shorter than 8 characters? Thank you.
proc contents results:
record_id | Char | 500 | $500. |
Proc print results:
Obs | record_id |
---|---|
1 | 25481 |
2 | 27775 |
3 | 167205 |
4 | 168552 |
5 | 195018 |
6 | 293336 |
7 | 303971 |
8 | 336269 |
9 | 360908 |
10 | 362220 |
11 | 00362383 |
12 | 370550 |
13 | 447997 |
14 | 00496297 |
15 | 499403 |
16 | 506068 |
17 | 506914 |
18 | 514282 |
19 | 525407 |
20 | 584554 |
21 | 681037 |
22 | 775671 |
23 | 788309 |
24 | 840175 |
25 | 862188 |
26 | 35044537 |
Thank you so much! It worked!
data have; input record_id $; length want $ 8; want=record_id; want=translate(right(want),'0',' '); cards; 25481 27775 ;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.