hello,
Do you know how to fill value with zero and reach a tens digit?
for table have
| have |
| CIK |
| 915913 |
| 1029506 |
| 3673 |
| 75677 |
| 0001091530 |
I expect to get table want
| want |
| CIK |
| 0000915913 |
| 0001029506 |
| 0000003673 |
| 0000075677 |
| 0001091530 |
thanks in davance.
data table1;
infile cards truncover;
input
CIK $100.
;
cards;
915913
1029506
3673
75677
0001091530
;
Use the Z. format.
cik = put( input(cik, 10.), z10.) ;
Use the Z. format.
cik = put( input(cik, 10.), z10.) ;
@Alexxxxxxx wrote:
hello,
Do you know how to fill value with zero and reach a tens digit?
for table have
have CIK 915913 1029506 3673 75677 0001091530 I expect to get table want
want CIK 0000915913 0001029506 0000003673 0000075677 0001091530
thanks in davance.
data table1; infile cards truncover; input CIK $100. ; cards; 915913 1029506 3673 75677 0001091530 ;
You have just shown why CIK (central index key from the SEC I presume) should always be treated a a character variable.
Try this (I replaced your $100. with $10.):
data table1;
infile cards truncover;
input cik $10.
cik=translate(right(cik),'0',' ');
cards;
915913
1029506
3673
75677
0001091530
;
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!
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.