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 ;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.